@slack/radar-mcp 1.17.0 → 1.18.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 +24 -7
- package/dist/mcp/flags-tools.d.ts +14 -9
- package/dist/mcp/flags-tools.js +70 -20
- package/dist/mcp/index.js +17 -10
- package/dist/mcp/platform-detect.d.ts +2 -0
- package/dist/mcp/platform-detect.js +2 -0
- package/dist/mcp/tools.js +4 -3
- package/dist/mcp/web-child-env.d.ts +1 -0
- package/dist/mcp/web-child-env.js +32 -0
- package/dist/shared/android-dashboard-screen.d.ts +15 -0
- package/dist/shared/android-dashboard-screen.js +48 -0
- package/dist/shared/android.d.ts +50 -0
- package/dist/shared/android.js +248 -35
- package/dist/shared/dashboard-screen.d.ts +35 -0
- package/dist/shared/dashboard-screen.js +12 -0
- package/dist/shared/ios-dashboard-screen.d.ts +32 -0
- package/dist/shared/ios-dashboard-screen.js +266 -0
- package/dist/shared/ios.d.ts +72 -0
- package/dist/shared/ios.js +313 -0
- package/dist/shared/platform.d.ts +3 -0
- package/dist/shared/platform.js +16 -0
- package/dist/shared/screen-artifacts.d.ts +10 -0
- package/dist/shared/screen-artifacts.js +57 -0
- package/dist/shared/screen.d.ts +20 -5
- package/dist/shared/screen.js +35 -39
- package/dist/shared/transport.d.ts +38 -0
- package/dist/shared/webapp.d.ts +1 -0
- package/dist/shared/webapp.js +2 -0
- package/dist/web/bin.js +5 -1
- package/dist/web/public/index.html +51 -11
- package/dist/web/public/next/app.js +16 -4
- package/dist/web/public/next/db.js +292 -39
- package/dist/web/public/next/flags.js +306 -48
- package/dist/web/public/next/registry.js +18 -10
- package/dist/web/public/next/screen.js +76 -11
- package/dist/web/public/next/store.js +280 -36
- package/dist/web/server.d.ts +26 -3
- package/dist/web/server.js +397 -179
- package/package.json +3 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
const SCREEN_DIRECTORY = path.join(os.homedir(), ".slack-radar", "screen");
|
|
5
|
+
const RECORDING_NAME = /^radar_screen_[\w-]+\.(mp4|png)$/;
|
|
6
|
+
/** Allocate an owner-only path for a recording containing sensitive screen content. */
|
|
7
|
+
export function createRecordingPath() {
|
|
8
|
+
fs.mkdirSync(SCREEN_DIRECTORY, { recursive: true, mode: 0o700 });
|
|
9
|
+
// mkdir's mode only applies when creating the directory. Repair permissions left by an
|
|
10
|
+
// older Radar version as well, so every implementation gets the same privacy posture.
|
|
11
|
+
try {
|
|
12
|
+
fs.chmodSync(SCREEN_DIRECTORY, 0o700);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
// Best-effort; secureRecording() still restricts the finished file itself.
|
|
16
|
+
}
|
|
17
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
18
|
+
return path.join(SCREEN_DIRECTORY, `radar_screen_${timestamp}.mp4`);
|
|
19
|
+
}
|
|
20
|
+
/** Restrict a completed recording to its owner. */
|
|
21
|
+
export function secureRecording(recording) {
|
|
22
|
+
try {
|
|
23
|
+
fs.chmodSync(recording, 0o600);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// Best-effort; the owner-only directory remains the primary control.
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** Remove a failed or cancelled recording without surfacing cleanup errors. */
|
|
30
|
+
export function removeRecording(recording) {
|
|
31
|
+
try {
|
|
32
|
+
fs.unlinkSync(recording);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// The file may not have been created yet.
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** Remove every Radar-owned screen recording at a session boundary. */
|
|
39
|
+
export function cleanupRecordings() {
|
|
40
|
+
try {
|
|
41
|
+
for (const file of fs.readdirSync(SCREEN_DIRECTORY)) {
|
|
42
|
+
if (RECORDING_NAME.test(file))
|
|
43
|
+
removeRecording(path.join(SCREEN_DIRECTORY, file));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// The directory may not exist yet.
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** Resolve a safe recording download without allowing traversal or unrelated files. */
|
|
51
|
+
export function recordingPath(file) {
|
|
52
|
+
const base = path.basename(file);
|
|
53
|
+
if (!RECORDING_NAME.test(base))
|
|
54
|
+
return null;
|
|
55
|
+
const recording = path.join(SCREEN_DIRECTORY, base);
|
|
56
|
+
return fs.existsSync(recording) ? recording : null;
|
|
57
|
+
}
|
package/dist/shared/screen.d.ts
CHANGED
|
@@ -39,10 +39,11 @@
|
|
|
39
39
|
import { type ChildProcess } from "child_process";
|
|
40
40
|
/**
|
|
41
41
|
* Remove all captures from the screen tmp dir. Recordings and screenshots both hold
|
|
42
|
-
* sensitive live screen content and must not linger across sessions on disk. Called
|
|
43
|
-
* resetScreenState()
|
|
44
|
-
*
|
|
45
|
-
*
|
|
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.
|
|
46
47
|
*/
|
|
47
48
|
export declare function cleanupRecordings(): void;
|
|
48
49
|
/** Resolve an ffmpeg binary, or null if none is installed. Cached. */
|
|
@@ -78,9 +79,12 @@ export declare function ffmpegInstallHint(): string;
|
|
|
78
79
|
export declare function screenCapabilities(): {
|
|
79
80
|
screenshot: boolean;
|
|
80
81
|
liveCast: boolean;
|
|
82
|
+
snapshotCast: boolean;
|
|
83
|
+
recording: boolean;
|
|
81
84
|
ffmpeg: boolean;
|
|
82
85
|
scrcpy: boolean;
|
|
83
86
|
installHint: string | null;
|
|
87
|
+
platform: string;
|
|
84
88
|
};
|
|
85
89
|
/** Grant consent to mirror the live screen. Per server process. */
|
|
86
90
|
export declare function grantScreenConsent(): void;
|
|
@@ -238,7 +242,18 @@ export declare function screenshotSaveErrorMessage(result: Extract<ScreenshotSav
|
|
|
238
242
|
* frame of whatever is on the phone, so the dir is owner-only and the file owner-read/write.
|
|
239
243
|
*/
|
|
240
244
|
export declare function saveScreenshot(): Promise<ScreenshotSaveResult>;
|
|
241
|
-
/**
|
|
245
|
+
/**
|
|
246
|
+
* Forget the cached display so the next use re-detects it, and NOTHING else. This is the safe
|
|
247
|
+
* subset of resetScreenState for a re-enable of the SAME device, where a live cast is very likely
|
|
248
|
+
* something the user is watching right now and the recordings on disk are theirs.
|
|
249
|
+
*/
|
|
250
|
+
export declare function resetScreenDetection(): void;
|
|
251
|
+
/**
|
|
252
|
+
* 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 (different
|
|
254
|
+
* hardware, a deliberate re-detect, or process exit): the recordings and the live cast are work a
|
|
255
|
+
* user may be in the middle of, so calling this when nothing actually changed destroys it.
|
|
256
|
+
*/
|
|
242
257
|
export declare function resetScreenState(): void;
|
|
243
258
|
/**
|
|
244
259
|
* Kill any live cast (and orphaned device-side screenrecord) on process exit. Mirrors
|
package/dist/shared/screen.js
CHANGED
|
@@ -36,12 +36,13 @@
|
|
|
36
36
|
* close; orphaned screenrecord procs congest the single adb transport. Kill
|
|
37
37
|
* explicitly on cleanup.
|
|
38
38
|
*/
|
|
39
|
-
import { spawn, execFile, execFileSync } from "child_process";
|
|
40
39
|
import fs from "fs";
|
|
41
40
|
import os from "os";
|
|
42
41
|
import path from "path";
|
|
42
|
+
import { spawn, execFile, execFileSync } from "child_process";
|
|
43
43
|
import { promisify } from "util";
|
|
44
44
|
import { resolveAdbPath } from "./android.js";
|
|
45
|
+
import { createRecordingPath, secureRecording, } from "./screen-artifacts.js";
|
|
45
46
|
const SC_TMP = path.join(os.homedir(), ".slack-radar", "screen");
|
|
46
47
|
/**
|
|
47
48
|
* The only file names this module writes into the screen tmp dir, and therefore the only
|
|
@@ -52,10 +53,11 @@ const SC_TMP = path.join(os.homedir(), ".slack-radar", "screen");
|
|
|
52
53
|
const CAPTURE_NAME = /^radar_screen_[\w-]+\.(mp4|png)$/;
|
|
53
54
|
/**
|
|
54
55
|
* Remove all captures from the screen tmp dir. Recordings and screenshots both hold
|
|
55
|
-
* sensitive live screen content and must not linger across sessions on disk. Called
|
|
56
|
-
* resetScreenState()
|
|
57
|
-
*
|
|
58
|
-
*
|
|
56
|
+
* sensitive live screen content and must not linger across sessions on disk. Called from
|
|
57
|
+
* resetScreenState(), so it runs on a session boundary (a device change, the first enable of
|
|
58
|
+
* the process, or a deliberate re-detect) and on process exit. It is NOT run on every device
|
|
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.
|
|
59
61
|
*/
|
|
60
62
|
export function cleanupRecordings() {
|
|
61
63
|
try {
|
|
@@ -191,12 +193,14 @@ export function ffmpegInstallHint() {
|
|
|
191
193
|
export function screenCapabilities() {
|
|
192
194
|
const ffmpeg = resolveFfmpeg() !== null;
|
|
193
195
|
return {
|
|
194
|
-
// screencap path is pure adb, always available when a device is attached.
|
|
195
196
|
screenshot: true,
|
|
196
197
|
liveCast: ffmpeg,
|
|
198
|
+
snapshotCast: false,
|
|
199
|
+
recording: ffmpeg,
|
|
197
200
|
ffmpeg,
|
|
198
201
|
scrcpy: hasScrcpy(),
|
|
199
|
-
installHint: ffmpeg ?
|
|
202
|
+
installHint: !ffmpeg ? ffmpegInstallHint() : null,
|
|
203
|
+
platform: "android",
|
|
200
204
|
};
|
|
201
205
|
}
|
|
202
206
|
// ---- consent (server-enforced, per process) ---------------------------------
|
|
@@ -689,24 +693,7 @@ export function startRecording() {
|
|
|
689
693
|
return null;
|
|
690
694
|
if (scLive.recording)
|
|
691
695
|
return scLive.recording.path;
|
|
692
|
-
|
|
693
|
-
// so the dir is owner-only (0700) and each mp4 owner-read/write only (0600) — the
|
|
694
|
-
// same posture the DB-browser uses for its equally-sensitive pulled copies. Without
|
|
695
|
-
// this the dir is world-traversable (~0755) and ffmpeg writes the file under the
|
|
696
|
-
// default umask (~0644, world-readable), exposing captures to other local users.
|
|
697
|
-
fs.mkdirSync(SC_TMP, { recursive: true, mode: 0o700 });
|
|
698
|
-
// mkdirSync's `mode` only applies when CREATING the dir; a dir left over from an
|
|
699
|
-
// earlier session (or created before this posture existed) keeps its old perms
|
|
700
|
-
// (~0755, world-traversable). chmod unconditionally so the owner-only guarantee
|
|
701
|
-
// holds regardless of when the dir first appeared.
|
|
702
|
-
try {
|
|
703
|
-
fs.chmodSync(SC_TMP, 0o700);
|
|
704
|
-
}
|
|
705
|
-
catch {
|
|
706
|
-
// best-effort; file is still written 0600 below
|
|
707
|
-
}
|
|
708
|
-
const safe = new Date().toISOString().replace(/[:.]/g, "-");
|
|
709
|
-
const out = path.join(SC_TMP, `radar_screen_${safe}.mp4`);
|
|
696
|
+
const out = createRecordingPath();
|
|
710
697
|
// Time the recording by real frame arrival, not a fixed input rate (the arg shape + the
|
|
711
698
|
// reasons it must be exactly this are in recordingArgs). The old args stamped every frame
|
|
712
699
|
// at a fixed 1/fps, so a clip recorded over N real seconds played back as frames/fps
|
|
@@ -738,12 +725,7 @@ export function stopRecording(L = scLive) {
|
|
|
738
725
|
// The finished mp4 holds captured screen content; restrict to owner before
|
|
739
726
|
// it is downloadable. The 0700 dir already blocks other-user traversal; this
|
|
740
727
|
// is defense-in-depth on the file itself (ffmpeg created it under the umask).
|
|
741
|
-
|
|
742
|
-
fs.chmodSync(r.path, 0o600);
|
|
743
|
-
}
|
|
744
|
-
catch {
|
|
745
|
-
// best-effort; dir perms are the primary control
|
|
746
|
-
}
|
|
728
|
+
secureRecording(r.path);
|
|
747
729
|
resolve(r.path);
|
|
748
730
|
}
|
|
749
731
|
};
|
|
@@ -816,11 +798,24 @@ export async function saveScreenshot() {
|
|
|
816
798
|
return { ok: true, path: out };
|
|
817
799
|
}
|
|
818
800
|
// ---- lifecycle ---------------------------------------------------------------
|
|
819
|
-
/**
|
|
820
|
-
|
|
801
|
+
/**
|
|
802
|
+
* Forget the cached display so the next use re-detects it, and NOTHING else. This is the safe
|
|
803
|
+
* subset of resetScreenState for a re-enable of the SAME device, where a live cast is very likely
|
|
804
|
+
* something the user is watching right now and the recordings on disk are theirs.
|
|
805
|
+
*/
|
|
806
|
+
export function resetScreenDetection() {
|
|
821
807
|
scDetected = false;
|
|
822
808
|
scDisplay = null;
|
|
823
809
|
scNote = "";
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* 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 (different
|
|
814
|
+
* hardware, a deliberate re-detect, or process exit): the recordings and the live cast are work a
|
|
815
|
+
* user may be in the middle of, so calling this when nothing actually changed destroys it.
|
|
816
|
+
*/
|
|
817
|
+
export function resetScreenState() {
|
|
818
|
+
resetScreenDetection();
|
|
824
819
|
if (scLive) {
|
|
825
820
|
cleanupLive(scLive);
|
|
826
821
|
scLive = null;
|
|
@@ -829,12 +824,12 @@ export function resetScreenState() {
|
|
|
829
824
|
// session boundary on disk.
|
|
830
825
|
cleanupRecordings();
|
|
831
826
|
// Best-effort: clean up orphaned device-side screenrecord procs that the host pipe
|
|
832
|
-
// close did not kill (they congest the single adb transport).
|
|
833
|
-
//
|
|
834
|
-
//
|
|
835
|
-
//
|
|
827
|
+
// close did not kill (they congest the single adb transport). `output-format=h264` is
|
|
828
|
+
// radar's own cmdline token — a manual `screenrecord /sdcard/foo.mp4` never carries it —
|
|
829
|
+
// so this reaches only radar's processes. Single token deliberately: adb shell rejoins
|
|
830
|
+
// and re-parses the argv, so a pattern containing a space would need device-side quoting.
|
|
836
831
|
try {
|
|
837
|
-
execFile(adb(), ["shell", "pkill", "-9", "-f", "
|
|
832
|
+
execFile(adb(), ["shell", "pkill", "-9", "-f", "output-format=h264"], { timeout: 5000 }, () => { });
|
|
838
833
|
}
|
|
839
834
|
catch {
|
|
840
835
|
// best-effort
|
|
@@ -885,7 +880,8 @@ function signalCleanup() {
|
|
|
885
880
|
scLive = null;
|
|
886
881
|
}
|
|
887
882
|
try {
|
|
888
|
-
|
|
883
|
+
// Radar's own cmdline token only; see the note in resetScreenState.
|
|
884
|
+
execFileSync(adb(), ["shell", "pkill", "-9", "-f", "output-format=h264"], {
|
|
889
885
|
timeout: 3000,
|
|
890
886
|
stdio: "ignore",
|
|
891
887
|
});
|
|
@@ -35,6 +35,8 @@ export interface DeviceInfo {
|
|
|
35
35
|
serial: string;
|
|
36
36
|
label: string;
|
|
37
37
|
state: string;
|
|
38
|
+
/** Platform discriminator for mixed or platform-specific device UIs. */
|
|
39
|
+
platform?: string;
|
|
38
40
|
}
|
|
39
41
|
export interface DeviceTransport {
|
|
40
42
|
/**
|
|
@@ -54,6 +56,15 @@ export interface DeviceTransport {
|
|
|
54
56
|
* transport has to opt in deliberately instead of inheriting access it cannot serve.
|
|
55
57
|
*/
|
|
56
58
|
readonly supportsLocalFileAccess?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Whether this transport can serve Radar's request/response HTTP tools (network calls, RTM,
|
|
61
|
+
* clogs, traces, feature flags, and ping).
|
|
62
|
+
*
|
|
63
|
+
* This is separate from supportsLocalFileAccess: the webapp transport serves the HTTP API but
|
|
64
|
+
* cannot read adb-backed databases or preferences. Absent means unsupported, so a new transport
|
|
65
|
+
* must opt in before callRadar can touch the host-global Radar port.
|
|
66
|
+
*/
|
|
67
|
+
readonly supportsRadarHttpTools?: boolean;
|
|
57
68
|
/**
|
|
58
69
|
* Whether this transport has a device dashboard for open_radar_dashboard to open.
|
|
59
70
|
*
|
|
@@ -258,4 +269,31 @@ export interface DeviceTransport {
|
|
|
258
269
|
serial: string;
|
|
259
270
|
label: string;
|
|
260
271
|
} | null;
|
|
272
|
+
/**
|
|
273
|
+
* Async variant of selectDevice for non-blocking boot/enable flows. Optional; platforms
|
|
274
|
+
* without an async device-listing path may omit it (the dashboard guards on presence).
|
|
275
|
+
*/
|
|
276
|
+
selectDeviceAsync?(serial: string | null): Promise<{
|
|
277
|
+
ok: true;
|
|
278
|
+
serial: string | null;
|
|
279
|
+
switched?: boolean;
|
|
280
|
+
devices: DeviceInfo[];
|
|
281
|
+
} | {
|
|
282
|
+
ok: false;
|
|
283
|
+
error: string;
|
|
284
|
+
devices: DeviceInfo[];
|
|
285
|
+
}>;
|
|
286
|
+
/**
|
|
287
|
+
* Async variant of reassertForward for non-blocking boot/enable flows. Optional.
|
|
288
|
+
*/
|
|
289
|
+
reassertForwardAsync?(): Promise<boolean>;
|
|
290
|
+
/**
|
|
291
|
+
* Async variant of activate for non-blocking boot/enable flows. Optional.
|
|
292
|
+
*/
|
|
293
|
+
activateAsync?(timeoutMinutes: number): Promise<void>;
|
|
294
|
+
/**
|
|
295
|
+
* Async probe for whether the radar local socket is bound on the device. Optional;
|
|
296
|
+
* only platforms that can test socket presence without blocking should implement this.
|
|
297
|
+
*/
|
|
298
|
+
radarSocketPresentAsync?(): Promise<"present" | "absent" | "unknown">;
|
|
261
299
|
}
|
package/dist/shared/webapp.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ import type { DeviceTransport } from "./transport.js";
|
|
|
20
20
|
*/
|
|
21
21
|
export declare class WebappTransport implements DeviceTransport {
|
|
22
22
|
readonly platform = "webapp";
|
|
23
|
+
readonly supportsRadarHttpTools = true;
|
|
23
24
|
private forwarded;
|
|
24
25
|
private currentTimeoutMinutes;
|
|
25
26
|
/**
|
package/dist/shared/webapp.js
CHANGED
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 { cleanupOnBind, createServer, seedInitialSpec, shutdownDashboard, startAutoCloseSweep, WEB_PORT, } from "./server.js";
|
|
6
|
+
import { armOnBoot, cleanupOnBind, createServer, 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
|
|
@@ -148,6 +148,10 @@ export function startWebServer() {
|
|
|
148
148
|
// in createServer) keeps importing the module — or a second launcher that loses the bind —
|
|
149
149
|
// from arming a timer that could process.exit. The interval is unref'd inside.
|
|
150
150
|
startAutoCloseSweep(server);
|
|
151
|
+
// Arm the device now, for the same post-bind reason: only the process that won the port may
|
|
152
|
+
// touch it. A fresh app process starts with Radar off, so without this every launch against
|
|
153
|
+
// one shows "waiting for device" until the human finds the Reconnect button.
|
|
154
|
+
armOnBoot();
|
|
151
155
|
const url = `http://localhost:${WEB_PORT}`;
|
|
152
156
|
console.log(`Slack Radar Web running at ${url}`);
|
|
153
157
|
// Auto-open the browser for the HUMAN launcher (`slack-radar web` / `slack-radar-web`),
|
|
@@ -267,6 +267,9 @@
|
|
|
267
267
|
.dbitem { padding:6px 9px; border-radius:7px; cursor:pointer; font-size:12.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
|
268
268
|
.dbitem:hover { background:var(--hover-soft); } .dbitem.sel { background:var(--sel-soft); color:var(--accent); } .dbitem .rows { float:right; color:var(--muted); font-size:11px; }
|
|
269
269
|
.dbitem.kbd { outline:2px solid var(--accent); outline-offset:-2px; } /* keyboard-focused row */
|
|
270
|
+
.dbhistbtn { background:var(--surface); border:1px solid var(--border-2); border-radius:8px; color:var(--muted); padding:0 12px; font:inherit; font-size:12.5px; cursor:pointer; display:flex; align-items:center; gap:6px; }
|
|
271
|
+
.dbhistbtn:hover { color:var(--text); border-color:var(--border-3); } .dbhistbtn.on { color:var(--accent); border-color:var(--accent); }
|
|
272
|
+
.dbhistn { color:var(--muted-2); font-size:11px; font-variant-numeric:tabular-nums; }
|
|
270
273
|
.dbmain { flex:1; min-width:0; display:flex; flex-direction:column; }
|
|
271
274
|
.dbqbar { display:flex; gap:8px; margin-bottom:8px; }
|
|
272
275
|
.dbqbar input { flex:1; background:var(--surface); border:1px solid var(--border-2); border-radius:8px; color:var(--text); padding:8px 11px; font:inherit; font-size:12.5px; } .dbqbar input:focus { outline:none; border-color:var(--accent); }
|
|
@@ -284,16 +287,27 @@
|
|
|
284
287
|
.dbout tr:hover td { background:var(--hover); }
|
|
285
288
|
.dbout tr { cursor:pointer; }
|
|
286
289
|
.dbout tr.rowsel td { background:var(--sel-soft); }
|
|
287
|
-
/* DB
|
|
288
|
-
Mirrors the feed's .stage.split
|
|
290
|
+
/* DB dock -- docked right of the grid, shared by the row detail and the query history via
|
|
291
|
+
tabs; the split shrinks the grid to make room. Mirrors the feed's .stage.split layout. */
|
|
289
292
|
.dbsplit { flex:1; min-height:0; display:flex; gap:14px; align-items:stretch; }
|
|
290
293
|
.dbsplit .dbout { flex:1; min-width:0; }
|
|
291
294
|
.dbsplit.open .dbout { flex:2 1 0; }
|
|
292
|
-
.
|
|
293
|
-
.
|
|
295
|
+
.dbdock { flex:1 1 360px; min-width:300px; max-width:520px; display:flex; flex-direction:column; min-height:0; background:var(--surface-2); border:1px solid var(--border); border-radius:10px; overflow:hidden; }
|
|
296
|
+
.dbdocktabs { display:flex; align-items:center; gap:6px; padding:8px 10px; border-bottom:1px solid var(--border); flex:0 0 auto; }
|
|
297
|
+
.dbtab { cursor:pointer; color:var(--muted); font-size:10.5px; text-transform:uppercase; letter-spacing:.06em; padding:3px 9px; border-radius:6px; border:1px solid transparent; }
|
|
298
|
+
.dbtab:hover { color:var(--text); } .dbtab.on { color:var(--accent-text); background:var(--accent-bg); border-color:var(--accent); }
|
|
299
|
+
.dbdocktabs .x { margin-left:auto; cursor:pointer; color:var(--muted-2); border:1px solid var(--border-3); border-radius:6px; padding:1px 8px; flex:0 0 auto; }
|
|
300
|
+
.dbdocktabs .x:hover { color:var(--error); border-color:var(--error); }
|
|
301
|
+
.rowinspector { flex:1; min-width:0; overflow:auto; padding:12px 14px; }
|
|
302
|
+
.rowinspector .inspector-hd { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
|
|
294
303
|
.rowinspector .inspector-hd .ttl { color:var(--text); font-size:13px; font-weight:600; word-break:break-word; }
|
|
295
|
-
|
|
296
|
-
.
|
|
304
|
+
/* query history (the dock's other tab) */
|
|
305
|
+
.dbhistbar { display:flex; justify-content:flex-end; padding:7px 12px 3px; flex:0 0 auto; }
|
|
306
|
+
.dbhistclear { cursor:pointer; color:var(--muted-2); font-size:10.5px; text-transform:uppercase; letter-spacing:.05em; } .dbhistclear:hover { color:var(--error); }
|
|
307
|
+
.dbhistlist { flex:1; min-height:0; overflow:auto; padding:0 6px 8px; }
|
|
308
|
+
.dbhist { padding:7px 10px; border-radius:7px; cursor:pointer; font-family:ui-monospace,Menlo,Consolas,monospace; font-size:11.5px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
|
309
|
+
.dbhist:hover { background:var(--hover-soft); color:var(--text); } .dbhist.kbd { outline:2px solid var(--accent); outline-offset:-2px; }
|
|
310
|
+
.dbhistempty { padding:14px; color:var(--muted); font-size:12px; line-height:1.5; }
|
|
297
311
|
.rowfield { border:1px solid var(--border); border-radius:8px; margin-bottom:8px; overflow:hidden; }
|
|
298
312
|
.rowfield-hd { display:flex; align-items:center; gap:8px; padding:6px 10px; background:var(--surface-2); border-bottom:1px solid var(--border); }
|
|
299
313
|
.rowfield-k { font-size:11px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted-2); font-weight:600; word-break:break-all; }
|
|
@@ -368,16 +382,38 @@
|
|
|
368
382
|
/* feature flags (source:"flags") -- reuses .dbout for the table */
|
|
369
383
|
.flagsview { display:flex; flex-direction:column; gap:10px; max-width:1180px; margin-top:8px; height:72vh; }
|
|
370
384
|
.flagsbar { display:flex; gap:10px; align-items:center; }
|
|
385
|
+
/* scope toggle: authenticated | unauthenticated | all, styled as a small segmented control */
|
|
386
|
+
.scopetabs { display:inline-flex; gap:2px; background:var(--surface-2); border:1px solid var(--border-2); border-radius:8px; padding:2px; flex-shrink:0; }
|
|
387
|
+
.scopetab { background:transparent; border:none; color:var(--muted); border-radius:6px; padding:4px 10px; font:inherit; font-size:11.5px; cursor:pointer; white-space:nowrap; }
|
|
388
|
+
.scopetab:hover { color:var(--text); }
|
|
389
|
+
.scopetab.sel { background:var(--accent-bg); color:var(--accent); font-weight:600; }
|
|
371
390
|
/* the filter input fills the row like the feed's, and shares the feedbar input styling */
|
|
372
391
|
.flagsbar .ffilterwrap { flex:1; min-width:140px; }
|
|
373
392
|
.flagsbar input { flex:1; background:var(--surface-2); border:1px solid var(--border-2); border-radius:8px; color:var(--text); padding:7px 10px; font:inherit; font-size:12.5px; } .flagsbar input:focus { outline:none; border-color:var(--accent); }
|
|
374
|
-
|
|
393
|
+
/* the meta line carries load-bearing facts (row counts, org names, the build note), so it uses
|
|
394
|
+
the AA-passing secondary token rather than --muted (3.8-4.2:1). */
|
|
395
|
+
.flagsmeta { color:var(--muted-2); font-size:11.5px; white-space:nowrap; }
|
|
375
396
|
.flagsrefresh { margin-left:auto; background:var(--surface); border:1px solid var(--border-2); color:var(--muted-2); border-radius:8px; padding:5px 12px; font:inherit; font-size:11.5px; cursor:pointer; } .flagsrefresh:hover { border-color:var(--accent); color:var(--text); }
|
|
376
|
-
|
|
397
|
+
/* --muted-2 like the org column beside it: same secondary-text role, and --muted under-contrasts
|
|
398
|
+
in light theme (3.8-4.2:1, see the note above). */
|
|
399
|
+
.flagsview .dbout th.scope, .flagsview .dbout td.scope { width:120px; color:var(--muted-2); font-size:11.5px; }
|
|
400
|
+
/* org ids are identifiers and can be long (an enterprise id, or a team id with a prefix), so
|
|
401
|
+
they get monospace and ellipsis; the cell carries the full value as a title. */
|
|
402
|
+
.flagsview .dbout th.org, .flagsview .dbout td.org { width:132px; color:var(--muted-2); font-family:ui-monospace,Menlo,Consolas,monospace; font-size:11.5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
403
|
+
.flagsview .dbout th.ftype, .flagsview .dbout td.ftype { width:96px; }
|
|
404
|
+
/* value column holds ON/OFF or an experiment group name (e.g. "treatment_a"), so it is wider
|
|
405
|
+
than the old boolean-only 90px */
|
|
406
|
+
.flagsview .dbout th.val, .flagsview .dbout td.val { width:140px; }
|
|
377
407
|
.flagsview .dbout th.origin, .flagsview .dbout td.origin { width:160px; }
|
|
378
408
|
.flagsview .dbout td.key { font-family:ui-monospace,Menlo,Consolas,monospace; color:var(--text); }
|
|
379
409
|
.flagval { font-variant-numeric:tabular-nums; font-weight:600; }
|
|
380
|
-
|
|
410
|
+
/* dim = every row of the flag agrees on this value. A solid token, not opacity: alpha-blended
|
|
411
|
+
accent green lands near 2:1 contrast, and with two orgs most of the column agrees, so the
|
|
412
|
+
dimmed state has to stay readable (--muted-2 measures >=6:1 on both themes, at rest; the 1.2s
|
|
413
|
+
flash fade briefly dips lower). Full-weight
|
|
414
|
+
pills use the text-grade tokens (accent-text 4.75-10.5:1, text-2 9.3-13.4:1) because they
|
|
415
|
+
carry the disagreement signal and the raw accent/muted tokens sat under 4.5:1 in light. */
|
|
416
|
+
.flagval.on { color:var(--accent-text); } .flagval.off { color:var(--text-2); } .flagval.dim { color:var(--muted-2); font-weight:400; }
|
|
381
417
|
.flagval.variant { font-variant-numeric:normal; font-family:ui-monospace,Menlo,Consolas,monospace; font-size:11.5px; }
|
|
382
418
|
.flagsview .dbout tr.overridden td { background:var(--hover); }
|
|
383
419
|
/* live observer patch: briefly highlight a row whose value just changed */
|
|
@@ -386,12 +422,16 @@
|
|
|
386
422
|
.orbadge { display:inline-block; padding:1px 7px; border-radius:4px; font-size:10.5px; font-weight:600; white-space:nowrap; border:1px solid var(--border-2); }
|
|
387
423
|
.orbadge.or-server { color:var(--accent); border-color:var(--accent); }
|
|
388
424
|
.orbadge.or-override { color:#ffb454; border-color:#ffb454; }
|
|
425
|
+
/* flag kind badge: experiment (multi-variant) vs toggle (boolean) */
|
|
426
|
+
.ftbadge { display:inline-block; padding:1px 7px; border-radius:4px; font-size:10.5px; font-weight:600; white-space:nowrap; border:1px solid var(--border-2); }
|
|
427
|
+
.ftbadge.ft-experiment { color:#b48ead; border-color:#b48ead; }
|
|
428
|
+
.ftbadge.ft-toggle { color:var(--muted); border-color:var(--border-2); }
|
|
389
429
|
/* screen overlay */
|
|
390
430
|
#screenpanel { position:fixed; top:0; right:0; bottom:0; width:340px; background:var(--surface-2); border-left:1px solid var(--border); z-index:40; display:flex; flex-direction:column; padding:12px; box-shadow:-4px 0 16px var(--shadow); overflow:auto; }
|
|
391
431
|
#screenpanel .schead { display:flex; align-items:center; gap:8px; margin-bottom:10px; }
|
|
392
432
|
#screenpanel .sctitle { font-size:12.5px; color:var(--text); font-weight:600; flex:1; }
|
|
393
|
-
#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 { border-color:var(--accent); color:var(--text); } #screenpanel .scbtn.rec { color:var(--error); border-color:var(--error); }
|
|
394
|
-
#screenimg { width:100%; border:1px solid var(--border); border-radius:8px; background:#000; min-height:120px; }
|
|
433
|
+
#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
|
+
#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; }
|
|
395
435
|
#schint { font-size:11.5px; color:var(--muted); margin-bottom:8px; line-height:1.5; }
|
|
396
436
|
/* Floating save confirmation. Lives outside the docked side panel on purpose: the panel is
|
|
397
437
|
only 340px wide and clipped to the right edge, and closing it (which auto-saves a running
|
|
@@ -39,7 +39,9 @@ function DeviceChip() {
|
|
|
39
39
|
const label = selected?.label ?? (ready.length === 1 ? ready[0].label : "none");
|
|
40
40
|
// A device-select failure (e.g. an ambiguous /enable 409). Shown in warn styling next to the
|
|
41
41
|
// picker, which stays usable so the user can pick a valid device (a successful pick clears it).
|
|
42
|
-
|
|
42
|
+
// Suppressed while a reconnect reason is on screen: two differently worded waiting spans in one
|
|
43
|
+
// header row explain the same outage twice, and the reconnect reason is the later answer.
|
|
44
|
+
const deviceError = store.visibleEnableError ? null : store.deviceError;
|
|
43
45
|
if (store.devicesError) {
|
|
44
46
|
return html `<span class="profilewrap" title="adb devices failed; check adb">device: <b>adb error</b></span>`;
|
|
45
47
|
}
|
|
@@ -51,8 +53,12 @@ function DeviceChip() {
|
|
|
51
53
|
</select>`;
|
|
52
54
|
return html `<span class="profilewrap" title="the device Radar is bound to; pick another to switch">device: ${picker}${deviceError ? html `<span class="conn waiting" style="margin-left:6px">${deviceError}</span>` : null}</span>`;
|
|
53
55
|
}
|
|
54
|
-
function Header({ screenOpen, onScreenToggle }) {
|
|
56
|
+
export function Header({ screenOpen, onScreenToggle }) {
|
|
55
57
|
const conn = useStoreValue(store, "conn", () => store.conn);
|
|
58
|
+
// Why the last Reconnect press failed, shown next to the button that produced it. The store's
|
|
59
|
+
// getter owns both conditions (disconnected, and the reason belongs to THIS outage rather than an
|
|
60
|
+
// earlier one), so there is no gating to get wrong here.
|
|
61
|
+
const enableError = useStoreValue(store, "enable-error", () => store.visibleEnableError);
|
|
56
62
|
const profile = useStoreValue(store, "profile", () => store.profileLabel);
|
|
57
63
|
const version = useStoreValue(store, "version", () => store.serverVersion);
|
|
58
64
|
const selfHeal = useStoreValue(store, "self-heal", () => store.selfHeal);
|
|
@@ -119,6 +125,7 @@ function Header({ screenOpen, onScreenToggle }) {
|
|
|
119
125
|
<span class="profilewrap" title="the device profile Radar is connected to (first app to launch wins the socket)">profile: <b>${profile}</b></span>
|
|
120
126
|
<${DeviceChip} />
|
|
121
127
|
${!connected ? html `<button class="reconnect" disabled=${busy} onClick=${reconnect}>${busy ? "⟳ enabling…" : "⟳ Reconnect Radar"}</button>` : null}
|
|
128
|
+
${enableError ? html `<span class="conn waiting">${enableError}</span>` : null}
|
|
122
129
|
<button class="themebtn" onClick=${toggleTheme} title="Toggle light / dark theme">${theme === "light" ? "🌙 Dark" : "☀ Light"}</button>
|
|
123
130
|
<button class=${"screenbtn" + (screenOpen ? " on" : "")} onClick=${onScreenToggle} title="Mirror the live device screen">▣ Screen</button>
|
|
124
131
|
<button class=${"themebtn killbtn" + (killArmed ? " armed" : "")} disabled=${killing} onClick=${kill} title=${killArmed ? "Click again to confirm" : "Stop the dashboard server"}>${killing ? "⏻ stopping…" : killArmed ? "⏻ Confirm stop?" : "⏻ Stop dashboard"}</button>
|
|
@@ -323,7 +330,12 @@ function App() {
|
|
|
323
330
|
<${ScreenOverlay} open=${screenOpen} onClose=${() => setScreenOpen(false)} />
|
|
324
331
|
`;
|
|
325
332
|
}
|
|
326
|
-
|
|
333
|
+
// Both the poll loops and the render are gated on the mount point existing. The render already was;
|
|
334
|
+
// store.start() was not, so importing this module anywhere without an #app element (a test) began
|
|
335
|
+
// polling /health, /spec and /_control/* against nothing. Starting the loops is only meaningful for a
|
|
336
|
+
// mounted app, so they belong on the same condition, which is also what makes Header testable.
|
|
327
337
|
const root = document.getElementById("app");
|
|
328
|
-
if (root)
|
|
338
|
+
if (root) {
|
|
339
|
+
store.start();
|
|
329
340
|
render(html `<${App} />`, root);
|
|
341
|
+
}
|