@slack/radar-mcp 1.21.0 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +114 -18
  2. package/dist/mcp/api-paths.d.ts +2 -2
  3. package/dist/mcp/api-paths.js +4 -19
  4. package/dist/mcp/dashboard-identity.d.ts +6 -0
  5. package/dist/mcp/dashboard-identity.js +11 -0
  6. package/dist/mcp/index.js +210 -145
  7. package/dist/mcp/logs-result.d.ts +1 -0
  8. package/dist/mcp/logs-result.js +1 -0
  9. package/dist/mcp/radar-export-get.d.ts +30 -0
  10. package/dist/mcp/radar-export-get.js +49 -0
  11. package/dist/mcp/radar-http.d.ts +22 -0
  12. package/dist/mcp/radar-http.js +61 -0
  13. package/dist/mcp/radar-response.d.ts +5 -1
  14. package/dist/mcp/radar-response.js +8 -3
  15. package/dist/mcp/session-backfill.js +3 -4
  16. package/dist/mcp/session-enable.d.ts +15 -0
  17. package/dist/mcp/session-enable.js +268 -19
  18. package/dist/mcp/snapshot.js +42 -26
  19. package/dist/mcp/sources-gate.js +6 -0
  20. package/dist/mcp/stale-dashboard.d.ts +23 -0
  21. package/dist/mcp/stale-dashboard.js +122 -0
  22. package/dist/mcp/switchboard-spool.d.ts +12 -0
  23. package/dist/mcp/switchboard-spool.js +107 -0
  24. package/dist/mcp/switchboard-tools.d.ts +9 -0
  25. package/dist/mcp/switchboard-tools.js +144 -6
  26. package/dist/mcp/test-cases.d.ts +14 -0
  27. package/dist/mcp/test-cases.js +77 -0
  28. package/dist/mcp/test-runs-tools.d.ts +8 -0
  29. package/dist/mcp/test-runs-tools.js +95 -0
  30. package/dist/mcp/tools.d.ts +4 -1
  31. package/dist/mcp/tools.js +101 -21
  32. package/dist/mcp/web-child-env.d.ts +4 -1
  33. package/dist/mcp/web-child-env.js +4 -1
  34. package/dist/shared/android.d.ts +44 -0
  35. package/dist/shared/android.js +234 -24
  36. package/dist/shared/constants.d.ts +9 -4
  37. package/dist/shared/constants.js +9 -4
  38. package/dist/shared/feature-flags.d.ts +1 -0
  39. package/dist/shared/feature-flags.js +1 -0
  40. package/dist/shared/ios-logs.d.ts +10 -0
  41. package/dist/shared/ios-logs.js +91 -0
  42. package/dist/shared/ios.d.ts +25 -2
  43. package/dist/shared/ios.js +157 -3
  44. package/dist/{web → shared}/log-session.d.ts +45 -31
  45. package/dist/shared/log-session.js +300 -0
  46. package/dist/shared/logcat-capture.js +17 -1
  47. package/dist/shared/radar-request-raw.d.ts +7 -0
  48. package/dist/shared/radar-request-raw.js +89 -0
  49. package/dist/shared/radar-token.d.ts +25 -0
  50. package/dist/shared/radar-token.js +164 -0
  51. package/dist/shared/stream.d.ts +3 -0
  52. package/dist/shared/stream.js +107 -15
  53. package/dist/shared/switchboard-host-store.d.ts +21 -0
  54. package/dist/shared/switchboard-host-store.js +166 -0
  55. package/dist/shared/switchboard-note.d.ts +15 -0
  56. package/dist/shared/switchboard-note.js +92 -0
  57. package/dist/shared/switchboard-report-file.d.ts +5 -0
  58. package/dist/shared/switchboard-report-file.js +26 -0
  59. package/dist/shared/switchboard-report.d.ts +20 -0
  60. package/dist/shared/switchboard-report.js +406 -0
  61. package/dist/shared/switchboard.d.ts +111 -2
  62. package/dist/shared/switchboard.js +436 -3
  63. package/dist/shared/transport.d.ts +49 -3
  64. package/dist/shared/version.d.ts +2 -0
  65. package/dist/shared/version.js +18 -0
  66. package/dist/shared/wire.d.ts +14 -1
  67. package/dist/web/install-app.d.ts +75 -8
  68. package/dist/web/install-app.js +330 -67
  69. package/dist/web/macapp/RadarApp.swift +487 -23
  70. package/dist/web/public/index.html +51 -9
  71. package/dist/web/public/next/app.js +33 -18
  72. package/dist/web/public/next/feed.js +102 -15
  73. package/dist/web/public/next/flags.js +3 -0
  74. package/dist/web/public/next/inspector.js +69 -3
  75. package/dist/web/public/next/prefs.js +5 -2
  76. package/dist/web/public/next/registry.js +18 -5
  77. package/dist/web/public/next/store.js +455 -29
  78. package/dist/web/public/next/switchboard-note.js +93 -0
  79. package/dist/web/public/next/toast.js +9 -5
  80. package/dist/web/public/next/voice-model.js +215 -35
  81. package/dist/web/public/next/voice.js +173 -18
  82. package/dist/web/server.d.ts +15 -11
  83. package/dist/web/server.js +690 -168
  84. package/dist/web/spec.d.ts +2 -1
  85. package/dist/web/spec.js +2 -1
  86. package/package.json +2 -2
  87. package/dist/web/log-session.js +0 -166
@@ -61,6 +61,8 @@
61
61
  .statusrow .conn { white-space:nowrap; }
62
62
  .statusrow .conn[title] { cursor:help; }
63
63
  .statusrow .reason { font-weight:400; flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; cursor:help; }
64
+ /* The exception is a refused outage: the held sentence, and the press or pick answer that replaces it, stay until the next action instead of mounting per tick, and their last words are the instruction, so they wrap instead of ellipsizing. */
65
+ .statusrow .reason.refusal { white-space:normal; }
64
66
  /* min-width holds the button's own width across its "Reconnect Radar" / "enabling…" relabel (the wider label measures ~150px; the headroom covers a wider fallback glyph). What keeps the button and the chip after it from shifting at an ATTEMPT boundary is the header's markup order: the changing recovery tail renders after them, on its own status row, and the conn span before them holds its text between the outage's two ends (a device-list change aside). */
65
67
  .reconnect { background:var(--surface); border:1px solid var(--warn); color:var(--warn-text, var(--warn)); border-radius:8px; padding:4px 12px; min-width:160px; text-align:center; font:inherit; font-size:12px; font-weight:600; cursor:pointer; }
66
68
  .reconnect:hover { border-color:var(--warn-2); } .reconnect:disabled { opacity:.75; cursor:default; }
@@ -317,6 +319,10 @@
317
319
  .voice-hd { display:flex; justify-content:space-between; align-items:center; font-size:11px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin-bottom:6px; }
318
320
  .voice-strip { display:flex; gap:14px; align-items:center; flex-wrap:wrap; font-size:12.5px; }
319
321
  .voice-pill { display:inline-flex; align-items:center; gap:6px; padding:2px 10px; border-radius:999px; border:1px solid var(--border-2); background:var(--surface-2); color:var(--text); }
322
+ /* Reset the UA button chrome that would otherwise show through .voice-pill's own look. */
323
+ button.voice-pill-server { font:inherit; text-align:inherit; cursor:pointer; }
324
+ button.voice-pill-server:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
325
+ :root.light button.voice-pill-server:focus-visible { outline-color:var(--accent-text); }
320
326
  .voice-dot { width:8px; height:8px; border-radius:50%; background:var(--muted); }
321
327
  .voice-dot.ok { background:var(--accent); box-shadow:0 0 6px var(--accent); }
322
328
  .voice-dot.bad { background:var(--error); }
@@ -333,9 +339,21 @@
333
339
  .voice-phase.slow { background:var(--lvl-err-bg); }
334
340
  .voice-phasetext { font-size:11px; margin-top:4px; }
335
341
  .voice-slowtxt { color:var(--error); }
336
- .voice-zoom { display:inline-flex; gap:4px; text-transform:none; letter-spacing:0; }
337
- .voice-zoombtn { font:inherit; font-size:11px; color:var(--muted-2); background:var(--surface-2); border:1px solid var(--border-2); border-radius:6px; padding:1px 8px; cursor:pointer; }
338
- .voice-zoombtn:hover { color:var(--text); border-color:var(--border-3); }
342
+ /* Export sits beside the zoom role="group", not inside it: the group's aria-label describes
343
+ the zoom buttons only. */
344
+ .voice-hd-tools { display:inline-flex; align-items:center; gap:4px; text-transform:none; letter-spacing:0; }
345
+ .voice-zoom { display:inline-flex; gap:4px; text-transform:none; letter-spacing:0; padding-right:8px; border-right:1px solid var(--border-2); }
346
+ .voice-zoombtn, .voice-exportbtn { font:inherit; font-size:11px; color:var(--muted-2); background:var(--surface-2); border:1px solid var(--border-2); border-radius:6px; padding:1px 8px; cursor:pointer; }
347
+ .voice-zoombtn:hover, .voice-exportbtn:hover { color:var(--text); border-color:var(--border-3); }
348
+ /* Flex gap (4px) plus this margin matches .voice-zoom's 8px padding-right, centering the divider. */
349
+ .voice-exportbtn { margin-left:4px; }
350
+ /* The button is never really disabled while exporting (that would drop it from tab order), so
351
+ aria-disabled is the selector that matches. */
352
+ .voice-exportbtn:disabled, .voice-exportbtn[aria-disabled="true"] { opacity:.5; cursor:progress; }
353
+ /* Keep hover from signaling "clickable" while a click is ignored. */
354
+ .voice-exportbtn[aria-disabled="true"]:hover { color:var(--muted-2); border-color:var(--border-2); }
355
+ .voice-exportbtn:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
356
+ :root.light .voice-exportbtn:focus-visible { outline-color:var(--accent-text); }
339
357
  /* Same accent tokens .modebtn.active uses for the mode picker, so the two "selected" controls
340
358
  on the page read as one visual language. */
341
359
  .voice-zoombtn.on { background:var(--accent-bg); border-color:var(--accent); color:var(--accent-text); font-weight:600; }
@@ -353,18 +371,23 @@
353
371
  a bar; the plot's own children are absolutely positioned over its (relatively positioned)
354
372
  box, sized as a percent of its width, which the SVG (width:100%) shares exactly. */
355
373
  .voice-trackrow { display:flex; }
356
- .voice-rowlabels { position:relative; width:56px; flex:0 0 56px; }
374
+ .voice-rowlabels { position:relative; width:96px; flex:0 0 96px; }
357
375
  /* line-height 18px matches ROW_H in voice.ts, the bar height each label sits beside, so the
358
376
  label text centres on its bar instead of hugging the top of the row. top is a percent of the
359
377
  plot's own height (set inline, per row, in voice.ts), not a fixed px, so the label still
360
378
  lines up with its bar if H ever changes. */
361
- .voice-rowlabels span { position:absolute; left:0; font-size:10px; color:var(--muted-2); line-height:18px; }
379
+ /* nowrap keeps "playback level" on one line so it stays beside its bar. */
380
+ .voice-rowlabels span { position:absolute; left:0; font-size:10px; color:var(--muted-2); line-height:18px; white-space:nowrap; }
362
381
  .voice-rowlabels { padding-right:6px; }
363
382
  .voice-plot { position:relative; flex:1 1 auto; min-width:0; }
364
- .voice-plot svg { width:100%; height:110px; display:block; }
383
+ /* Fallback only: voice.ts sets the real height inline via plotHeight(hasLevels). A mismatch
384
+ with the viewBox height would scale every row's y and misalign the row labels. */
385
+ .voice-plot svg { width:100%; height:172px; display:block; }
365
386
  .voice-ticklabels { position:absolute; left:0; right:0; bottom:0; height:12px; pointer-events:none; }
366
387
  .voice-ticklabels span { position:absolute; bottom:0; transform:translateX(-50%); font-size:10px; color:var(--muted-2); }
367
- .voice-nomarkers { position:absolute; bottom:14px; right:4px; font-size:10px; }
388
+ /* top is set inline by voice.ts to pin the note to the markers row; anchoring to the bottom
389
+ would land it on the playback level row. */
390
+ .voice-nomarkers { position:absolute; right:4px; font-size:10px; }
368
391
  /* A guide line's opacity is a class, not an inline attr, so the light theme can read it a
369
392
  touch stronger than dark: a faint line against a light background disappears much faster
370
393
  than the same opacity against dark. */
@@ -373,6 +396,8 @@
373
396
  .voice-legend { display:flex; gap:8px 14px; font-size:11px; color:var(--muted-2); margin-top:8px; flex-wrap:wrap; }
374
397
  .voice-legend span::before { content:""; display:inline-block; width:10px; height:10px; border-radius:2px; margin-right:6px; vertical-align:-1px; background:var(--muted); }
375
398
  .voice-legend .m::before { background:var(--blue); } .voice-legend .y::before { background:var(--accent); } .voice-legend .r::before { background:var(--warn); } .voice-legend .s::before { background:var(--purple); } .voice-legend .f::before { background:var(--muted-2); }
399
+ /* Plain swatch, matching the clipped peak rect in voice.ts's levelBars. */
400
+ .voice-legend .clip::before { background:var(--error); }
376
401
  /* Legend swatches teach the tracks' own shapes, not just their colours: a thin vertical bar
377
402
  for the line-tick markers (half height for the focus tick, half width for the stop tick,
378
403
  matching their own glyphs), a two-band gradient standing in for the stall's dashed cap, and a
@@ -385,6 +410,8 @@
385
410
  .voice-legend .mx::before { width:6px; height:14px; border-radius:0; background:linear-gradient(var(--text),var(--text)) 50% 0/6px 6px no-repeat, linear-gradient(var(--text),var(--text)) 50% 100%/3px 6px no-repeat; }
386
411
  .voice-legend .mu::before { border:1px dashed var(--purple); background:repeating-linear-gradient(to bottom, var(--purple) 0 1px, transparent 1px 3px); }
387
412
  .voice-legend .mb::before { width:7px; height:11px; border-radius:3.5px; background:var(--muted); }
413
+ /* A scale note, not a marker kind: a swatch would imply a marker colour that does not exist. */
414
+ .voice-legend .lv::before { content:none; margin-right:0; }
388
415
  .voice-cards { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:8px; }
389
416
  .voice-stat { background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:6px 10px; display:flex; flex-direction:column; }
390
417
  .voice-stat .v { font-size:22px; font-weight:700; line-height:1; margin-bottom:2px; color:var(--text); font-variant-numeric:tabular-nums; } .voice-stat .l { font-size:11px; color:var(--muted-2); margin-top:auto; }
@@ -448,6 +475,19 @@
448
475
  pre.json color or the tokens render monochrome. */
449
476
  .j-key { color:var(--j-key); } .j-str { color:var(--j-str); } .j-num { color:var(--j-num); } .j-bool { color:var(--j-bool); } .j-null { color:var(--j-null); font-style:italic; }
450
477
  .inspector pre.json .j-key { color:var(--j-key); } .inspector pre.json .j-str { color:var(--j-str); } .inspector pre.json .j-num { color:var(--j-num); } .inspector pre.json .j-bool { color:var(--j-bool); } .inspector pre.json .j-null { color:var(--j-null); }
478
+ /* Collapsible objects/arrays. The caret hangs into the space before the bracket, so the
479
+ layout matches unfolded JSON; it is ::before content so it never lands in a copy. */
480
+ .j-tog { display:inline-block; width:1ch; margin-left:-1ch; padding:0; border:0; background:none; font:inherit; line-height:inherit; cursor:pointer; user-select:none; color:var(--muted); }
481
+ .j-tog:focus-visible { outline:1px solid var(--accent); }
482
+ /* Empty alt text keeps the glyph out of the accessible name, so the title (Fold/Unfold) is the
483
+ name. The plain declaration first is the fallback for Firefox before 128 and Safari before 17.4,
484
+ which drop the slash form. */
485
+ .j-tog::before { content:"▾"; content:"▾" / ""; }
486
+ .j-tog:hover { color:var(--text); }
487
+ .j-closed > .j-tog::before { content:"▸"; content:"▸" / ""; }
488
+ .j-ell { display:none; color:var(--muted); font-style:italic; cursor:pointer; }
489
+ .j-closed > .j-inner { display:none; }
490
+ .j-closed > .j-ell { display:inline; }
451
491
  /* key/value grid for headers */
452
492
  .trunc { background:var(--lvl-warn-bg); border:1px solid var(--warn); color:var(--warn-2); border-radius:6px; padding:7px 9px; font-size:11.5px; line-height:1.5; margin-bottom:8px; }
453
493
  .inspector pre.rawbody { color:var(--text-2); }
@@ -605,7 +645,8 @@
605
645
  .valexpand td { background:var(--surface-2); padding:10px; border-bottom:1px solid var(--rowline); white-space:normal; max-width:none; }
606
646
  .valexpandbar { display:flex; gap:8px; margin-bottom:8px; }
607
647
  .valexpandbar button { background:var(--surface); border:1px solid var(--border-3); border-radius:6px; color:var(--muted-2); padding:3px 10px; font:inherit; font-size:11px; cursor:pointer; } .valexpandbar button:hover { border-color:var(--accent); color:var(--accent); }
608
- .valpretty { margin:0; white-space:pre-wrap; word-break:break-word; font-size:11.5px; line-height:1.45; color:var(--text-2); max-height:300px; overflow:auto; }
648
+ /* padding-left leaves room for the root JSON fold caret, which hangs 1ch left and overflow would clip */
649
+ .valpretty { margin:0; padding-left:1ch; white-space:pre-wrap; word-break:break-word; font-size:11.5px; line-height:1.45; color:var(--text-2); max-height:300px; overflow:auto; }
609
650
  .truncwarn { background:var(--lvl-info-bg); border:1px solid var(--blue); color:var(--blue); border-radius:8px; padding:8px 11px; font-size:11.5px; margin-bottom:10px; }
610
651
  /* Stronger treatment for the "no matches" case where files were skipped -- a search that
611
652
  could not read anything is a different severity than one that read everything and found
@@ -678,7 +719,8 @@
678
719
  recording) unmounts it entirely, so anything panel-local can be invisible exactly when it
679
720
  matters most. Bottom-center and transient. Ignores clicks unless it has a saved file to
680
721
  reveal, which is the one case the rule below opts into. */
681
- #radartoast { position:fixed; left:50%; bottom:28px; transform:translateX(-50%) translateY(8px); background:var(--surface); border:1px solid var(--accent); color:var(--text); border-radius:8px; padding:8px 16px; font-size:12.5px; box-shadow:0 4px 16px var(--shadow); z-index:70; opacity:0; pointer-events:none; transition:opacity .15s ease, transform .15s ease; }
722
+ /* max-width wraps a long export note into a readable block, keeping 16px margin on narrow windows. */
723
+ #radartoast { position:fixed; left:50%; bottom:28px; transform:translateX(-50%) translateY(8px); background:var(--surface); border:1px solid var(--accent); color:var(--text); border-radius:8px; padding:8px 16px; font-size:12.5px; max-width:min(640px, calc(100vw - 32px)); text-align:center; box-shadow:0 4px 16px var(--shadow); z-index:70; opacity:0; pointer-events:none; transition:opacity .15s ease, transform .15s ease; }
682
724
  #radartoast.on { opacity:1; transform:translateX(-50%) translateY(0); }
683
725
  /* Only a save confirmation that actually has a file to reveal takes clicks. The default
684
726
  stays pointer-events:none above, because a toast floats over rows the user is clicking
@@ -8,7 +8,7 @@ import { html } from "./html.js";
8
8
  import { render } from "preact";
9
9
  import { useState, useEffect, useCallback, useRef } from "preact/hooks";
10
10
  import { useStoreValue } from "./hooks.js";
11
- import { store, MODES, modeServed, describeConstraints, AUTO_REARM_MAX_FAILS, specMatchesMode } from "./store.js";
11
+ import { store, MODES, modeServed, describeConstraints, AUTO_REARM_MAX_FAILS } from "./store.js";
12
12
  import { SOURCES } from "./registry.js";
13
13
  import { Feed } from "./feed.js";
14
14
  import { Cards } from "./widgets.js";
@@ -71,6 +71,7 @@ export function Header({ screenOpen, onScreenToggle }) {
71
71
  // answer), so there is no gating to get wrong here.
72
72
  const enableError = useStoreValue(store, "enable-error", () => store.visibleEnableError);
73
73
  const enableInstructs = useStoreValue(store, "enable-error", () => store.visibleEnableInstructs);
74
+ const refusal = useStoreValue(store, "refusal", () => store.refusal);
74
75
  const profile = useStoreValue(store, "profile", () => store.profileLabel);
75
76
  const version = useStoreValue(store, "version", () => store.serverVersion);
76
77
  const selfHeal = useStoreValue(store, "self-heal", () => store.selfHeal);
@@ -99,11 +100,12 @@ export function Header({ screenOpen, onScreenToggle }) {
99
100
  // but renders its own "checking…" tail rather than an instruction the reply may withdraw.
100
101
  const selfArmBlocked = useStoreValue(store, "self-arm-blocked", () => store.selfArmBlocked);
101
102
  const mayAutoRearm = selfArmBlocked === false;
102
- // A device-select failure (e.g. an ambiguous /enable 409). Only a later pick that works clears
103
- // it; a bound-device change does not (a failed pick the server did pin moves the baseline
103
+ // A device-select failure (e.g. an ambiguous 409). Cleared by a pick that works, a refusal
104
+ // mounting or a reset; a bound-device change does not (a pin that landed moves the baseline
104
105
  // after the error is written, so the error is about the device just pinned — see
105
- // checkSerialEdge). Suppressed while a reconnect reason is on screen (two differently worded
106
- // spans explaining one outage) and during an /enable flight (a new attempt supersedes the old
106
+ // checkSerialEdge). Suppressed while an enable answer is on screen (two differently worded
107
+ // spans explaining one outage); it outranks the held refusal sentence, since the pick is the
108
+ // later action. Also suppressed during an /enable flight (a new attempt supersedes the old
107
109
  // answer, and visibleEnableError is null for the same reason).
108
110
  const pickError = useStoreValue(store, "device-error", () => store.deviceError);
109
111
  const pickInstructs = useStoreValue(store, "device-error", () => store.deviceErrorInstructs);
@@ -173,6 +175,7 @@ export function Header({ screenOpen, onScreenToggle }) {
173
175
  return html `<h1>SLACK RADAR DASHBOARD <span class="conn waiting">● dashboard stopped</span></h1>`;
174
176
  }
175
177
  const connected = conn.state === "connected";
178
+ const refusalReason = enabling || enableError || pickError ? null : refusal;
176
179
  // The no-radar-session wording is split in two so the controls between them hold still: the
177
180
  // conn span keeps the fixed diagnosis ("● no radar session on the device") for the whole
178
181
  // outage, and the part that changes with what the automation is doing renders in its own
@@ -191,9 +194,13 @@ export function Header({ screenOpen, onScreenToggle }) {
191
194
  // hover) and present whenever the Reconnect button is — so a reason mounting or unmounting at an
192
195
  // attempt boundary, or at a manual press in an undiagnosed outage, changes what the row says,
193
196
  // not how tall the header is (a height change reflows everything below it).
197
+ // The one exception is a refused outage (.reason.refusal): the held sentence and the press or
198
+ // pick answer that replaces it wrap instead of ellipsizing, since their last words instruct.
194
199
  //
195
- // The tail's precedence, each rung earning its rank: an unresolved device PICK outranks
196
- // everything (the policy refuses to act until the human picks, so promising a retry would be
200
+ // The tail's precedence, each rung earning its rank: a FAILED PRESS or a FAILED PICK in a refused
201
+ // outage outranks all of these, since none exist there (the no-session latch and its automation
202
+ // are retired by the refusal); then an unresolved device PICK outranks everything else (the
203
+ // policy refuses to act until the human picks, so promising a retry would be
197
204
  // false); a flight IN PROGRESS outranks the give-up wording (a manual press after give-up
198
205
  // must not render "press Reconnect" beside its own disabled, already-pressed button; the
199
206
  // manual flight renders no tail at all, since the button already reads "enabling…"); a
@@ -229,7 +236,14 @@ export function Header({ screenOpen, onScreenToggle }) {
229
236
  : flapped
230
237
  ? "Auto re-enable gave up, the session keeps dying soon after coming back"
231
238
  : "Auto re-enable gave up after " + AUTO_REARM_MAX_FAILS + " tries";
232
- const tailText = !inOutage || needsPick
239
+ // A refused press has no tail, and its answer usually repeats the sentence already shown.
240
+ // The tail names the outcome so the press is visible; the span beside it says why.
241
+ // The pick answer gets the same tail so the row reads as the pick's result,
242
+ // not as the picked device refusing.
243
+ // An answer without an instruction gets the press here, so the row keeps exactly one.
244
+ const pressFailed = refusal !== null && !!enableError;
245
+ const pickFailed = refusal !== null && !!visiblePickError;
246
+ const tailText = pressFailed ? "Reconnect failed" + press : pickFailed ? "Pick failed" + press : !inOutage || needsPick
233
247
  ? null
234
248
  : enabling || autoRearming
235
249
  ? autoRearming
@@ -271,7 +285,9 @@ export function Header({ screenOpen, onScreenToggle }) {
271
285
  <h1>
272
286
  SLACK RADAR DASHBOARD
273
287
  <span class=${"conn " + conn.state}>${connLabel}</span>
274
- <span class="profilewrap" title="the device profile Radar is connected to (first app to launch wins the socket)">profile: <b>${profile}</b></span>
288
+ ${profile
289
+ ? html `<span class="profilewrap" title="the device profile Radar is connected to (first app to launch wins the socket)">profile: <b>${profile}</b></span>`
290
+ : null}
275
291
  <${DeviceChip} />
276
292
  ${!connected ? html `<button class="reconnect" disabled=${enabling} onClick=${reconnect}>${enabling ? "⟳ enabling…" : "⟳ Reconnect Radar"}</button>` : null}
277
293
  ${suppressed
@@ -300,7 +316,7 @@ export function Header({ screenOpen, onScreenToggle }) {
300
316
  ${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}
301
317
  ${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}
302
318
  ${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 for dashboards at this address" title="Hide this hint permanently for dashboards at this address">✕</button></span>` : null}
303
- ${statusRow ? html `<span class="statusrow">${recoveryTail ? html `<span class=${"conn " + conn.state} title=${tailTitle}>${recoveryTail}</span>` : null}${enableError ? html `<span class="conn waiting reason" title=${enableError}>${enableError}</span>` : null}${visiblePickError ? html `<span class="conn waiting reason" title=${visiblePickError}>${visiblePickError}</span>` : null}</span>` : null}
319
+ ${statusRow ? html `<span class="statusrow">${recoveryTail ? html `<span class=${"conn " + conn.state} title=${tailTitle}>${recoveryTail}</span>` : null}${enableError ? html `<span class=${"conn waiting reason" + (pressFailed ? " refusal" : "")} title=${enableError}>${enableError}</span>` : null}${refusalReason ? html `<span class="conn waiting reason refusal" title=${refusalReason}>${refusalReason}</span>` : null}${visiblePickError ? html `<span class=${"conn waiting reason" + (refusal !== null ? " refusal" : "")} title=${visiblePickError}>${visiblePickError}</span>` : null}</span>` : null}
304
320
  </h1>
305
321
  `;
306
322
  }
@@ -313,9 +329,8 @@ export function ModeBar() {
313
329
  const serves = (m) => modeServed(m.key, deviceSources);
314
330
  // A device switch can hide the active tab (leaner build). Reset to the first tab so the
315
331
  // user is never stranded on an invisible mode rendering a dead feed. Through pushPreset like
316
- // every other preset push, so the level floor rides along: Live carries log rows, so a bare
317
- // MODES[0].spec would not just skip the floor for this one push, applySpec would also forget
318
- // it (lastLogLevel back to ""), and the next Logs click would start at VERBOSE.
332
+ // every other preset push, so the platform log package and level floor ride along. Live carries
333
+ // log rows, so a bare MODES[0].spec would forget both pieces of platform/view state.
319
334
  useEffect(() => {
320
335
  if (activeKey && activeKey !== "__custom__" && !modeServed(activeKey, deviceSources)) {
321
336
  store.pushPreset(MODES[0].spec);
@@ -393,7 +408,7 @@ function StreamView({ spec }) {
393
408
  <span class="summary">${spec.summary || spec.title}</span>
394
409
  <span class="tech">${tech}</span>
395
410
  </div>
396
- <${Filters} spec=${spec} remembered=${specMatchesMode(spec) !== null} />
411
+ <${Filters} spec=${spec} remembered=${store.matchesMode(spec) !== null} />
397
412
  <${Cards} spec=${spec} />
398
413
  ${showsVoicePanel(spec) ? html `<${VoicePanel} onInspect=${(ev) => setSelected(ev)} />` : null}
399
414
  <div class=${"stage" + (selected ? " split" : "")}>
@@ -445,12 +460,12 @@ function App() {
445
460
  return;
446
461
  const nextKey = keys[next];
447
462
  const preset = MODES.find((m) => m.key === nextKey)?.spec;
448
- if (nextKey === "__custom__") {
449
- if (store.lastCustomSpec)
450
- store.setSpec(store.lastCustomSpec);
463
+ if (nextKey === "__custom__" && store.lastCustomSpec) {
464
+ store.setSpec(store.lastCustomSpec);
451
465
  }
452
- else if (preset)
466
+ else if (preset) {
453
467
  store.pushPreset(preset);
468
+ }
454
469
  e.preventDefault();
455
470
  };
456
471
  window.addEventListener("keydown", onKey);
@@ -5,10 +5,12 @@
5
5
  // and the RENDER side (windowed rows + keyboard model).
6
6
  import { html } from "./html.js";
7
7
  import { useState, useEffect, useRef, useCallback, useMemo } from "preact/hooks";
8
- import { store, shortUrl, shortPkg, MODES, modeServed, fmtNum, specMatchesMode, searchText, parseExcludeTerm, isGappedFieldTerm } from "./store.js";
8
+ import { store, shortUrl, shortPkg, MODES, modeServed, fmtNum, searchText, parseExcludeTerm, isGappedFieldTerm } from "./store.js";
9
9
  import { gappedFieldHint } from "./filters.js";
10
10
  import { STREAM_KINDS, LOG_LEVEL_ORDER, levelRank, EXCLUDE_MAX_TERMS, EXCLUDE_MAX_TERM_LENGTH, SWITCHBOARD_KINDS } from "./registry.js";
11
11
  import { parseFilter, tokenize, isCompleteTerm, isQuote } from "./filter.js";
12
+ import { inSessionCut, sameSessionCut } from "./voice-model.js";
13
+ import { savedTurnLabel, switchboardClockLabel } from "./switchboard-note.js";
12
14
  const ROW_H = 24;
13
15
  const OVERSCAN = 10;
14
16
  // How long the empty line's counts may stay behind the cache after an eviction before the next
@@ -166,6 +168,18 @@ export function switchboardArrow(direction) {
166
168
  export function switchboardFailed(ev) {
167
169
  return ev.kind === "state" && /fail|error/i.test(String(ev.to ?? ""));
168
170
  }
171
+ // dBFS reads better than a raw 0..1 peak: 0.05 and 0.5 both look "quiet" on a linear scale, but
172
+ // -26 dBFS and -6 dBFS say which one is actually louder. Floored at -60 to match the sparkline's
173
+ // own floor, same reason a near-zero peak doesn't round to an unreadable -80.
174
+ const FEED_DBFS_FLOOR = -60;
175
+ function fmtDbfsPeak(linear) {
176
+ if (linear == null)
177
+ return "?";
178
+ const v = Math.max(0, Math.min(1, linear));
179
+ if (v <= 0)
180
+ return "silent";
181
+ return `${Math.round(Math.max(FEED_DBFS_FLOOR, 20 * Math.log10(v)))} dBFS`;
182
+ }
169
183
  // The per-kind summary after the badge: the kind's own fields by name (switchboardFields, the
170
184
  // search haystack, lists the same ones), minus the kind (already the badge) and, for frames, minus
171
185
  // the direction (already the arrow), with units for the numbers.
@@ -191,6 +205,40 @@ export function switchboardSummary(ev) {
191
205
  const g = num(ev.gap_ms), q = num(ev.bytes_queued);
192
206
  return `${text(ev.event)}${g != null ? ` gap ${fmtNum(g)} ms` : ""}${q != null ? ` queued ${fmtNum(q)} B` : ""}`;
193
207
  }
208
+ // Shows size, reach, and peak loudness, not averaged rms, since averaging would wash out
209
+ // the one loud spike a debugger is usually looking for.
210
+ case "levels": {
211
+ const sampleCount = num(ev.sample_count);
212
+ const offsets = Array.isArray(ev.offsets_ms) ? ev.offsets_ms : [];
213
+ const lastOffset = offsets.length ? num(offsets[offsets.length - 1]) : null;
214
+ // A plain loop, not Math.max(...nums): spreading a levels batch with tens of thousands of
215
+ // samples into function arguments blows the engine's own call-stack argument limit.
216
+ const maxOf = (arr) => {
217
+ if (!Array.isArray(arr))
218
+ return null;
219
+ let max = -Infinity;
220
+ let found = false;
221
+ for (const v of arr) {
222
+ if (typeof v === "number" && Number.isFinite(v)) {
223
+ found = true;
224
+ if (v > max)
225
+ max = v;
226
+ }
227
+ }
228
+ return found ? max : null;
229
+ };
230
+ const micPeak = maxOf(ev.mic_peak);
231
+ const playbackPeak = maxOf(ev.playback_peak);
232
+ return `${sampleCount ?? "?"} sample${sampleCount === 1 ? "" : "s"}${lastOffset != null ? ` over ${fmtNum(lastOffset)} ms` : ""}, peak mic ${fmtDbfsPeak(micPeak)} / playback ${fmtDbfsPeak(playbackPeak)}`;
233
+ }
234
+ // An unknown clock shows as sent (switchboardClockLabel passes it through).
235
+ case "turn": {
236
+ const r = num(ev.response_ms);
237
+ const c = typeof ev.clock === "string" ? switchboardClockLabel(ev.clock) : "";
238
+ return [r != null ? `${fmtNum(r)} ms` : "", c].filter(Boolean).join(", ");
239
+ }
240
+ // An unknown outcome shows as its device token, quoted unless plain (see savedTurnLabel).
241
+ case "saved_turn": return savedTurnLabel(ev.outcome, ev.has_thread);
194
242
  default: return "";
195
243
  }
196
244
  }
@@ -349,9 +397,10 @@ export function Feed({ spec, onInspect, selectedId }) {
349
397
  // the new tail (O(new), not a full O(N) rebuild over 100k) -- the 100k-buffer enabler. Full
350
398
  // recompute() runs only on control change / resume; a non-newest sort rebuilds while tailing.
351
399
  //
352
- // The cache only ever loses entries from the front (TTL, the cap) or in a clear, so "what is new
353
- // since the last bump" is the run after a cursor, and the length alone cannot place the cursor:
354
- // at the cap a shift plus a push leaves it flat. The entry that sat at the cursor is the proof.
400
+ // The cache only ever loses entries from the front (TTL, the cap) or when the clear button or a
401
+ // device switch wipes it, so "what is new since the last bump" is the run after a cursor, and
402
+ // the length alone cannot place the cursor: at the cap a shift plus a push leaves it flat. The
403
+ // entry that sat at the cursor is the proof.
355
404
  // When it is still there the run starts after it; when it moved, the run starts after wherever
356
405
  // it went; when it is gone, everything held is new.
357
406
  const seenLenRef = useRef(0);
@@ -370,14 +419,47 @@ export function Feed({ spec, onInspect, selectedId }) {
370
419
  seenLenRef.current = cacheLen;
371
420
  seenTailRef.current = store.cache[cacheLen - 1];
372
421
  };
422
+ // The Switchboard tab shows only the newest session's current run (store.switchboardNewestCut(),
423
+ // the same rule the panel draws with); the other tabs and search see every row. The cut is
424
+ // tracked here because a change to it (a newer begin, a reused id's new run, the newest begin
425
+ // evicted) changes which rows belong in the view without touching the cache's front, the one
426
+ // thing the incremental cursor below can see.
427
+ const sbCutRef = useRef(source === "switchboard" ? store.switchboardNewestCut() : null);
373
428
  // The empty line's running counts (see the render below for the recount). `len`/`tail` is the
374
429
  // counts' own cursor, `parsed`/`key` the controls they were counted under.
375
430
  const countsRef = useRef({ held: 0, belowLevel: 0, excluded: 0, excludedByKind: 0, offBox: 0, waiting: 0, len: 0, tail: undefined, dirty: true, stale: false, at: 0, parsed: null, key: "" });
431
+ // Zero the counts and mark them for a recount, for a change to which rows the view admits: the
432
+ // old counts were sorted under the old rule, and an empty view must not name them.
433
+ const resetCounts = () => {
434
+ const cnt = countsRef.current;
435
+ cnt.held = 0;
436
+ cnt.belowLevel = 0;
437
+ cnt.excluded = 0;
438
+ cnt.excludedByKind = 0;
439
+ cnt.offBox = 0;
440
+ cnt.waiting = 0;
441
+ cnt.len = store.cache.length;
442
+ cnt.tail = store.cache[store.cache.length - 1];
443
+ cnt.dirty = true;
444
+ cnt.stale = false;
445
+ };
376
446
  useEffect(() => {
377
447
  snapRef.current = recompute();
378
448
  bumpSnap((n) => n + 1);
379
449
  markSeen(store.cache.length);
450
+ sbCutRef.current = source === "switchboard" ? store.switchboardNewestCut() : null;
380
451
  const off = store.on("feed", () => {
452
+ if (source === "switchboard") {
453
+ const cut = store.switchboardNewestCut();
454
+ if (!sameSessionCut(cut, sbCutRef.current)) {
455
+ sbCutRef.current = cut;
456
+ forceSnap();
457
+ resetCounts();
458
+ markSeen(store.cache.length);
459
+ setNewCount(0);
460
+ return;
461
+ }
462
+ }
381
463
  const cacheLen = store.cache.length;
382
464
  const startLen = runStart(seenLenRef.current, seenTailRef.current, cacheLen);
383
465
  // The empty line's counts are kept running, so the rows that landed are sorted into them
@@ -408,6 +490,8 @@ export function Feed({ spec, onInspect, selectedId }) {
408
490
  continue;
409
491
  if (src !== "all" && c.type !== src)
410
492
  continue;
493
+ if (src === "switchboard" && sbCutRef.current !== null && !inSessionCut(c.ev, sbCutRef.current))
494
+ continue;
411
495
  const ev = c.ev;
412
496
  ev._type = c.type;
413
497
  if (!store.passesMatch(ev))
@@ -463,8 +547,10 @@ export function Feed({ spec, onInspect, selectedId }) {
463
547
  if (el)
464
548
  el.scrollTop = 0; // glue to newest (top)
465
549
  });
466
- return off;
467
- }, [recompute, matchParsed, sort, sortOpts]);
550
+ return () => {
551
+ off();
552
+ };
553
+ }, [forceSnap, recompute, matchParsed, sort, sortOpts]);
468
554
  // Rebuild when the SERVER-SIDE filter (match/bodyContains/minLevel) changes -- that changes
469
555
  // what store.matches() admits, so the whole snapshot must refresh. Keyed so it only fires on a
470
556
  // real filter change, not every spec poll. minLevel is part of the key because the level
@@ -535,9 +621,12 @@ export function Feed({ spec, onInspect, selectedId }) {
535
621
  cnt.excludedByKind = 0;
536
622
  cnt.offBox = 0;
537
623
  cnt.waiting = 0;
624
+ const cut = source === "switchboard" ? store.switchboardNewestCut() : null;
538
625
  for (const c of store.cache) {
539
626
  if (!c || (source !== "all" && c.type !== source))
540
627
  continue;
628
+ if (cut !== null && !inSessionCut(c.ev, cut))
629
+ continue;
541
630
  const ev = c.ev;
542
631
  ev._type = c.type;
543
632
  if (!store.passesMatch(ev))
@@ -984,10 +1073,10 @@ export function Feed({ spec, onInspect, selectedId }) {
984
1073
  return Promise.resolve({ ok: false, note: "one term at a time, no commas" });
985
1074
  const at = store.spec ?? spec;
986
1075
  const mySource = (at.source ?? "all");
987
- const myTab = specMatchesMode(at);
1076
+ const myTab = store.matchesMode(at);
988
1077
  const out = { refusal: null, stale: false };
989
1078
  return store.updateSpec((base) => {
990
- if (base.source !== at.source || specMatchesMode(base) !== myTab) {
1079
+ if (base.source !== at.source || store.matchesMode(base) !== myTab) {
991
1080
  out.stale = true;
992
1081
  return null;
993
1082
  }
@@ -1105,7 +1194,7 @@ export function Feed({ spec, onInspect, selectedId }) {
1105
1194
  }, []);
1106
1195
  // Memory is a preset tab's: a Custom view has no key to come back to, so its copy must not
1107
1196
  // promise one.
1108
- const excludeRemembered = specMatchesMode(spec) !== null;
1197
+ const excludeRemembered = store.matchesMode(spec) !== null;
1109
1198
  // build only the visible slice
1110
1199
  const slice = [];
1111
1200
  for (let i = first; i < last; i++) {
@@ -1340,12 +1429,10 @@ export function Feed({ spec, onInspect, selectedId }) {
1340
1429
  el.blur();
1341
1430
  const ns = neighborTabSpec(e.key === "ArrowRight" ? 1 : -1);
1342
1431
  // Presets carry the level floor the way a tab click does; the Custom spec is pushed as is.
1343
- if (ns) {
1344
- if (ns === store.lastCustomSpec)
1345
- store.setSpec(ns);
1346
- else
1347
- store.pushPreset(ns);
1348
- }
1432
+ if (ns === store.lastCustomSpec)
1433
+ store.setSpec(ns);
1434
+ else if (ns)
1435
+ store.pushPreset(ns);
1349
1436
  }
1350
1437
  }}
1351
1438
  onInput=${(e) => {
@@ -33,6 +33,7 @@
33
33
  // is_overridden, else Server.
34
34
  import { html } from "./html.js";
35
35
  import { useState, useEffect, useCallback, useRef } from "preact/hooks";
36
+ import { normalizeStreamType } from "./registry.js";
36
37
  // A row is unique per (scope, org_id, type, key), not by key alone: the device lists each key once
37
38
  // per scope AND once per signed-in org, and a toggle and an experiment could share a name. Leaving
38
39
  // org out collapsed two workspaces onto one row, so whichever wrote last won. `scope` is a
@@ -228,6 +229,8 @@ export function FlagsBrowser() {
228
229
  catch {
229
230
  return;
230
231
  }
232
+ if (f.type)
233
+ f.type = normalizeStreamType(f.type);
231
234
  if (f.type === "_status") {
232
235
  const state = f.event?.state;
233
236
  // The device came back (reinstall, sleep, re-arm): rows it dropped or re-orged while away
@@ -49,7 +49,7 @@ export function highlightJson(value, indent = 0) {
49
49
  if (!value.length)
50
50
  return "[]";
51
51
  const items = value.map((v) => padIn + highlightJson(v, indent + 1));
52
- return "[\n" + items.join(",\n") + "\n" + pad + "]";
52
+ return fold("[", "]", items, pad, plural(items.length, "item"));
53
53
  }
54
54
  if (t === "object") {
55
55
  const obj = value;
@@ -57,10 +57,76 @@ export function highlightJson(value, indent = 0) {
57
57
  if (!keys.length)
58
58
  return "{}";
59
59
  const items = keys.map((k) => padIn + '<span class="j-key">"' + esc(k) + '"</span>: ' + highlightJson(obj[k], indent + 1));
60
- return "{\n" + items.join(",\n") + "\n" + pad + "}";
60
+ return fold("{", "}", items, pad, plural(items.length, "key"));
61
61
  }
62
62
  return esc(String(value));
63
63
  }
64
+ // The caret is drawn by CSS (::before), so selecting and copying the text yields plain JSON.
65
+ function fold(open, close, items, pad, count) {
66
+ return '<span class="j-fold"><button type="button" class="j-tog" aria-expanded="true" title="' + foldTitle(false) + '"></button>' + open +
67
+ '<span class="j-inner">\n' + items.join(",\n") + "\n" + pad + "</span>" +
68
+ '<span class="j-ell"> … ' + count + " </span>" + close + "</span>";
69
+ }
70
+ // Delegated click for every highlightJson <pre>: the markup is raw HTML, so it has no handlers
71
+ // of its own. Alt-click applies the same state to every nested fold.
72
+ export function onJsonFoldClick(e) {
73
+ const target = e.target;
74
+ if (!target?.classList?.contains("j-tog") && !target?.classList?.contains("j-ell"))
75
+ return;
76
+ const node = target.parentElement;
77
+ if (!node)
78
+ return;
79
+ const closed = !node.classList.contains("j-closed");
80
+ setFold(node, closed);
81
+ if (e.altKey)
82
+ node.querySelectorAll(".j-fold").forEach((n) => setFold(n, closed));
83
+ }
84
+ // A collapsed fold's contents are display:none, so the browser copies its "… N keys"
85
+ // placeholder instead. The hidden nodes are still in the selected range: copy them and drop
86
+ // the placeholders. A selection that also takes in other text keeps the browser's own copy.
87
+ export function onJsonCopy(e) {
88
+ const sel = window.getSelection();
89
+ const pre = e.currentTarget;
90
+ if (!sel || sel.isCollapsed || !sel.rangeCount || !e.clipboardData)
91
+ return;
92
+ const range = clampToPre(sel.getRangeAt(0), pre);
93
+ if (!range)
94
+ return;
95
+ e.clipboardData.setData("text/plain", jsonCopyText(range.cloneContents()));
96
+ e.preventDefault();
97
+ }
98
+ // A triple-click, or a drag past a one-line collapsed root, ends the range at the start of the
99
+ // next block, just outside the <pre>. Trim that overshoot when it adds no text.
100
+ function clampToPre(range, pre) {
101
+ const r = range.cloneRange();
102
+ let outside = "";
103
+ if (!pre.contains(r.startContainer)) {
104
+ const before = range.cloneRange();
105
+ before.setEnd(pre, 0);
106
+ outside += before.toString();
107
+ r.setStart(pre, 0);
108
+ }
109
+ if (!pre.contains(r.endContainer)) {
110
+ const after = range.cloneRange();
111
+ after.setStart(pre, pre.childNodes.length);
112
+ outside += after.toString();
113
+ r.setEnd(pre, pre.childNodes.length);
114
+ }
115
+ return outside.trim() ? null : r;
116
+ }
117
+ export function jsonCopyText(root) {
118
+ for (const cls of [".j-ell", ".j-tog"])
119
+ root.querySelectorAll(cls).forEach((n) => n.parentNode?.removeChild(n));
120
+ return root.textContent ?? "";
121
+ }
122
+ function setFold(node, closed) {
123
+ node.classList.toggle("j-closed", closed);
124
+ node.firstElementChild?.setAttribute("aria-expanded", String(!closed));
125
+ node.firstElementChild?.setAttribute("title", foldTitle(closed));
126
+ }
127
+ function foldTitle(closed) {
128
+ return (closed ? "Unfold" : "Fold") + " (Alt-click: all nested)";
129
+ }
64
130
  function Section({ title, sub, children, open }) {
65
131
  const [isOpen, setOpen] = useState(open !== false);
66
132
  return html `
@@ -75,7 +141,7 @@ function Section({ title, sub, children, open }) {
75
141
  `;
76
142
  }
77
143
  function JsonPre({ value }) {
78
- return html `<pre class="json" dangerouslySetInnerHTML=${{ __html: highlightJson(value, 0) }}></pre>`;
144
+ return html `<pre class="json" onClick=${onJsonFoldClick} onCopy=${onJsonCopy} dangerouslySetInnerHTML=${{ __html: highlightJson(value, 0) }}></pre>`;
79
145
  }
80
146
  // A decoded form body: one row per field, a JSON-valued field in its own collapsible subtree
81
147
  // through the same highlighter the JSON body uses, everything else as its decoded text.
@@ -11,7 +11,7 @@
11
11
  import { html } from "./html.js";
12
12
  import { useState, useEffect, useCallback, useRef } from "preact/hooks";
13
13
  import { useLatestRef, useGlobalKeydown } from "./hooks.js";
14
- import { highlightJson } from "./inspector.js";
14
+ import { highlightJson, onJsonCopy, onJsonFoldClick } from "./inspector.js";
15
15
  function profileLabel(u) {
16
16
  return u === "" || u == null ? "device" : u === "0" ? "personal (user 0)" : "secondary (user " + u + ")";
17
17
  }
@@ -153,6 +153,9 @@ export function PrefsBrowser({ spec }) {
153
153
  const t = e.target;
154
154
  if (t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.tagName === "SELECT" || t.isContentEditable))
155
155
  return;
156
+ // A focused button (a JSON fold caret, Copy, Close) owns its Enter and Space, as in the feed.
157
+ if (t?.tagName === "BUTTON" && (e.key === "Enter" || e.key === " "))
158
+ return;
156
159
  if (e.metaKey || e.ctrlKey || e.altKey)
157
160
  return;
158
161
  const s = st.current;
@@ -387,7 +390,7 @@ function PrefsGrid({ rows, rowOffset = 0, expandedIdx = null, onToggleExpanded,
387
390
  <button onClick=${() => onToggleExpanded?.(globalIdx)}>Close</button>
388
391
  </div>
389
392
  ${parsed !== null
390
- ? html `<pre class="valpretty" dangerouslySetInnerHTML=${{ __html: highlightJson(parsed) }}></pre>`
393
+ ? html `<pre class="valpretty" onClick=${onJsonFoldClick} onCopy=${onJsonCopy} dangerouslySetInnerHTML=${{ __html: highlightJson(parsed) }}></pre>`
391
394
  : html `<pre class="valpretty">${valueStr}</pre>`}
392
395
  </td>
393
396
  </tr>`