@slack/radar-mcp 1.17.1 → 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.
@@ -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
+ }
@@ -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 on
43
- * resetScreenState() (device re-enable) and on process exit — the same posture the
44
- * DB-browser uses for its pulled copies. Scoped to the names this module writes so it
45
- * never deletes an unrelated file that landed in the dir.
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
- /** Reset detection + tear down any live cast. Called on device re-enable and shutdown. */
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
@@ -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 on
56
- * resetScreenState() (device re-enable) and on process exit — the same posture the
57
- * DB-browser uses for its pulled copies. Scoped to the names this module writes so it
58
- * never deletes an unrelated file that landed in the dir.
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 ? null : ffmpegInstallHint(),
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
- // Recordings capture live screen content (open DMs, message text, notifications),
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
- try {
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
- /** Reset detection + tear down any live cast. Called on device re-enable and shutdown. */
820
- export function resetScreenState() {
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). NOTE: `-f screenrecord`
833
- // is device-WIDE — it kills every screenrecord on the device, not just radar's. That
834
- // is intentional for a debug tool (radar should not leave the transport congested),
835
- // but a user running an unrelated manual screenrecord would have it killed too.
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", "screenrecord"], { timeout: 5000 }, () => { });
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
- execFileSync(adb(), ["shell", "pkill", "-9", "-f", "screenrecord"], {
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
  }
@@ -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
  /**
@@ -19,6 +19,8 @@
19
19
  */
20
20
  export class WebappTransport {
21
21
  platform = "webapp";
22
+ // The local webapp dev server is itself the Radar HTTP endpoint; no adb/file access is implied.
23
+ supportsRadarHttpTools = true;
22
24
  forwarded = false;
23
25
  currentTimeoutMinutes = 5;
24
26
  /**
@@ -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 row detail panel -- docked right of the grid; the split shrinks the grid to make room.
288
- Mirrors the feed's .stage.split + .inspector layout. */
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
- .rowinspector { flex:1 1 360px; min-width:300px; max-width:520px; overflow:auto; background:var(--surface-2); border:1px solid var(--border); border-radius:10px; padding:12px 14px; }
293
- .rowinspector .inspector-hd { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:8px; }
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
- .rowinspector .inspector-hd .x { cursor:pointer; color:var(--muted-2); border:1px solid var(--border-3); border-radius:6px; padding:1px 8px; flex:0 0 auto; }
296
- .rowinspector .inspector-hd .x:hover { color:var(--error); border-color:var(--error); }
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
- .flagsmeta { color:var(--muted); font-size:11.5px; white-space:nowrap; }
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
- .flagsview .dbout th.val, .flagsview .dbout td.val { width:90px; }
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
- .flagval.on { color:var(--accent); } .flagval.off { color:var(--muted); } .flagval.dim { opacity:.55; font-weight:400; }
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