@slack/radar-mcp 1.11.0 → 1.13.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 +12 -2
- package/dist/mcp/api-paths.js +2 -0
- package/dist/mcp/flags-tools.d.ts +71 -0
- package/dist/mcp/flags-tools.js +158 -0
- package/dist/mcp/index.js +103 -5
- package/dist/mcp/prefs-tools.d.ts +15 -0
- package/dist/mcp/prefs-tools.js +204 -0
- package/dist/mcp/session-enable.d.ts +2 -1
- package/dist/mcp/session-enable.js +29 -2
- package/dist/mcp/snapshot.js +6 -1
- package/dist/mcp/sources-gate.d.ts +23 -0
- package/dist/mcp/sources-gate.js +63 -0
- package/dist/mcp/tools.js +102 -2
- package/dist/shared/android.d.ts +33 -1
- package/dist/shared/android.js +203 -6
- package/dist/shared/constants.d.ts +8 -0
- package/dist/shared/constants.js +13 -1
- package/dist/shared/db.d.ts +21 -3
- package/dist/shared/db.js +89 -23
- package/dist/shared/feature-flags.d.ts +6 -0
- package/dist/shared/feature-flags.js +17 -0
- package/dist/shared/prefs.d.ts +78 -0
- package/dist/shared/prefs.js +416 -0
- package/dist/shared/transport.d.ts +68 -0
- package/dist/web/log-session.d.ts +13 -0
- package/dist/web/log-session.js +16 -0
- package/dist/web/public/index.html +129 -3
- package/dist/web/public/next/app.js +82 -4
- package/dist/web/public/next/feed.js +270 -14
- package/dist/web/public/next/filter.js +200 -0
- package/dist/web/public/next/flags.js +179 -0
- package/dist/web/public/next/prefs.js +399 -0
- package/dist/web/public/next/registry.js +16 -6
- package/dist/web/public/next/store.js +250 -11
- package/dist/web/server.js +267 -7
- package/dist/web/spec.d.ts +7 -7
- package/dist/web/spec.js +15 -9
- package/package.json +1 -1
|
@@ -56,13 +56,16 @@
|
|
|
56
56
|
.reconnect { background:var(--surface); border:1px solid var(--warn); color:var(--warn); border-radius:8px; padding:4px 12px; font:inherit; font-size:12px; font-weight:600; cursor:pointer; }
|
|
57
57
|
.reconnect:hover { border-color:var(--warn-2); } .reconnect:disabled { opacity:.6; cursor:default; }
|
|
58
58
|
.profilewrap { font-size:12px; color:var(--blue-2); } .profilewrap b { color:var(--text); }
|
|
59
|
+
.profilewrap select { background:var(--surface); border:1px solid var(--border-2); border-radius:6px; color:var(--text); padding:3px 6px; font:inherit; font-size:11px; margin-left:4px; cursor:pointer; }
|
|
60
|
+
h1 .version { margin-left:auto; font-size:11px; font-weight:400; color:var(--muted-2); letter-spacing:0; }
|
|
59
61
|
.themebtn, .screenbtn { background:var(--surface); border:1px solid var(--border-2); color:var(--muted-2); border-radius:8px; padding:5px 12px; font:inherit; font-size:12.5px; cursor:pointer; }
|
|
60
62
|
.themebtn:hover, .screenbtn:hover { border-color:var(--accent); color:var(--text); } .screenbtn.on { background:var(--accent-bg); border-color:var(--accent); color:var(--accent-text); }
|
|
61
|
-
.modebar { display:flex; gap:6px; margin:0 0 6px; flex-wrap:wrap; flex:0 0 auto; }
|
|
63
|
+
.modebar { display:flex; gap:6px; margin:0 0 6px; flex-wrap:wrap; flex:0 0 auto; align-items:center; }
|
|
62
64
|
.modebtn { background:var(--surface); border:1px solid var(--border-2); color:var(--muted-2); border-radius:8px; padding:6px 14px; font:inherit; font-size:12.5px; cursor:pointer; }
|
|
63
65
|
.modebtn:hover { border-color:var(--accent); color:var(--text); }
|
|
64
66
|
.modebtn.active { background:var(--accent-bg); border-color:var(--accent); color:var(--accent-text); font-weight:600; }
|
|
65
67
|
.modebtn.custom { margin-left:10px; border-style:dashed; color:var(--purple); } .modebtn.custom.active { background:var(--accent-bg); border-color:var(--purple); color:var(--purple); }
|
|
68
|
+
.modedivider { width:1px; height:20px; background:var(--border-2); margin:0 4px; }
|
|
66
69
|
.sub { margin:0 0 6px; flex:0 0 auto; } .sub .summary { display:block; color:var(--text-2); font-size:12px; font-weight:600; } .sub .tech { display:none; }
|
|
67
70
|
/* filters — slim when collapsed */
|
|
68
71
|
.filters { max-width:1100px; margin-bottom:6px; flex:0 0 auto; }
|
|
@@ -121,11 +124,59 @@
|
|
|
121
124
|
.stage.split .feedwrap-next { flex:2 1 380px; min-width:0; } .stage.split .inspector { flex:1 1 300px; }
|
|
122
125
|
.feedwrap-next { flex:1; min-width:0; display:flex; flex-direction:column; min-height:0; }
|
|
123
126
|
.feedbar { display:flex; gap:8px; align-items:center; margin-bottom:8px; flex-wrap:wrap; flex:0 0 auto; }
|
|
124
|
-
|
|
127
|
+
/* Filter box: pills + draft input wrap together in one field-shaped container (Android
|
|
128
|
+
Studio Logcat style). The wrap owns the border + padding + focus ring; the input inside
|
|
129
|
+
is chromeless so pills + draft read as one control. Pills flex-wrap onto more lines when
|
|
130
|
+
the query is long. */
|
|
131
|
+
.ffilterwrap { position:relative; flex:1; display:flex; flex-wrap:wrap; align-items:center; gap:5px; min-width:140px; background:var(--surface-2); border:1px solid var(--border-2); border-radius:8px; padding:4px 26px 4px 6px; cursor:text; }
|
|
132
|
+
.ffilterwrap:focus-within { border-color:var(--accent); }
|
|
133
|
+
.ffilterwrap .ffilter { flex:1; min-width:80px; background:transparent; border:none; padding:3px 4px; font:inherit; font-size:12.5px; color:var(--text); }
|
|
134
|
+
.ffilterwrap .ffilter:focus { outline:none; }
|
|
125
135
|
.feedbar input { 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; }
|
|
126
136
|
.feedbar input:focus { outline:none; border-color:var(--accent); }
|
|
127
|
-
.ffilterclear { position:absolute; right:8px; top:
|
|
137
|
+
.ffilterclear { position:absolute; right:8px; top:9px; cursor:pointer; color:var(--muted-2); background:var(--surface); border-radius:50%; width:16px; height:16px; line-height:14px; text-align:center; font-size:10px; }
|
|
128
138
|
.ffilterclear:hover { color:#fff; background:var(--error-2); }
|
|
139
|
+
/* The draft input turns amber when its own text is an invalid regex mid-typing. Committed
|
|
140
|
+
terms use the per-pill amber (.fpill-bad) instead. */
|
|
141
|
+
.ffilterwrap:has(.ffilter.finvalid) { border-color:var(--warn); }
|
|
142
|
+
/* Fallback for browsers without :has(): the wrap keeps its normal border and the draft
|
|
143
|
+
amber shows on the input itself via a bottom border. */
|
|
144
|
+
.feedbar input.ffilter.finvalid { box-shadow:inset 0 -2px 0 var(--warn); }
|
|
145
|
+
/* Pills. Compact rounded chip inside the wrap; regex pills stay monospace so slashes read
|
|
146
|
+
as syntax. Every pill uses the same base padding + font-size as the input so the row
|
|
147
|
+
lines up visually. */
|
|
148
|
+
.fpill { display:inline-flex; align-items:center; gap:4px; background:var(--surface); border:1px solid var(--border-3); color:var(--text); border-radius:6px; padding:1px 4px 1px 7px; font-size:12.5px; line-height:1.4; max-width:340px; cursor:pointer; }
|
|
149
|
+
.fpill:hover { border-color:var(--accent); }
|
|
150
|
+
.fpill:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
|
|
151
|
+
.fpill-body { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
|
152
|
+
.fpill-sign { color:var(--muted-2); font-weight:700; margin-right:1px; }
|
|
153
|
+
.fpill-x { cursor:pointer; color:var(--muted-2); background:var(--surface-3); border-radius:50%; width:14px; height:14px; line-height:13px; text-align:center; font-size:9.5px; margin-left:2px; }
|
|
154
|
+
.fpill-x:hover { color:#fff; background:var(--error-2); }
|
|
155
|
+
.fpill-neg { background:var(--lvl-err-bg); border-color:var(--error-2); color:var(--error-2); }
|
|
156
|
+
.fpill-neg .fpill-sign { color:var(--error-2); }
|
|
157
|
+
.fpill-re, .fpill-quote { font-family:ui-monospace,Menlo,Consolas,monospace; }
|
|
158
|
+
.fpill-bad { background:var(--lvl-warn-bg); border-color:var(--warn); color:var(--warn-2); }
|
|
159
|
+
/* Kind-name pills on the Live view. Match the row's type chip color so "clog" reads the
|
|
160
|
+
same whether you see it in the pill or in the row's tchip. */
|
|
161
|
+
.fpill-kind-network { background:var(--chip-net-bg); border-color:var(--blue); color:var(--blue); }
|
|
162
|
+
.fpill-kind-rtm { background:var(--chip-rtm-bg); border-color:var(--purple); color:var(--purple); }
|
|
163
|
+
.fpill-kind-clog { background:var(--chip-clog-bg); border-color:var(--accent); color:var(--accent); }
|
|
164
|
+
.fpill-kind-trace { background:var(--chip-trace-bg); border-color:var(--warn); color:var(--warn); }
|
|
165
|
+
.fpill-kind-log { background:var(--chip-log-bg); border-color:var(--chip-log-fg); color:var(--chip-log-fg); }
|
|
166
|
+
/* A negated kind pill (e.g. -log) carries BOTH .fpill-neg and .fpill-kind-* at once; equal
|
|
167
|
+
specificity means whichever rule is defined later in the stylesheet wins, which happened
|
|
168
|
+
to be the kind color, burying the negation-red the "-" glyph is there to signal. The
|
|
169
|
+
compound selector below outranks the plain .fpill-kind-* rules so negated-red always wins
|
|
170
|
+
the background, regardless of source order. */
|
|
171
|
+
.fpill-neg.fpill-kind-network,
|
|
172
|
+
.fpill-neg.fpill-kind-rtm,
|
|
173
|
+
.fpill-neg.fpill-kind-clog,
|
|
174
|
+
.fpill-neg.fpill-kind-trace,
|
|
175
|
+
.fpill-neg.fpill-kind-log {
|
|
176
|
+
background: var(--lvl-err-bg);
|
|
177
|
+
border-color: var(--error-2);
|
|
178
|
+
color: var(--error-2);
|
|
179
|
+
}
|
|
129
180
|
.fbtn { background:var(--surface); border:1px solid var(--border-3); border-radius:8px; color:var(--text); padding:6px 10px; font:inherit; font-size:12px; cursor:pointer; white-space:nowrap; }
|
|
130
181
|
.fbtn:hover { border-color:var(--accent); } .fbtn:disabled { opacity:.4; cursor:default; } .fbtn.paused { color:var(--warn); border-color:var(--warn); }
|
|
131
182
|
.fcount { color:var(--muted); font-size:11.5px; white-space:nowrap; }
|
|
@@ -230,7 +281,82 @@
|
|
|
230
281
|
.dbout th { position:sticky; top:0; background:var(--surface); color:var(--muted-2); text-align:left; padding:7px 10px; border-bottom:1px solid var(--border); white-space:nowrap; }
|
|
231
282
|
.dbout td { padding:6px 10px; border-bottom:1px solid var(--rowline); max-width:380px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
232
283
|
.dbout tr:hover td { background:var(--hover); }
|
|
284
|
+
/* Prefs browser: mirrors db.ts CSS, same visual language */
|
|
285
|
+
.prefsview { display:flex; gap:16px; max-width:1180px; margin-top:8px; height:72vh; }
|
|
286
|
+
.prefsside { flex:0 0 260px; overflow:auto; border:1px solid var(--border); border-radius:10px; padding:12px; }
|
|
287
|
+
.prefssec { color:var(--muted); font-size:10.5px; text-transform:uppercase; letter-spacing:.06em; margin:6px 0 6px; } .prefssec:not(:first-child){ margin-top:14px; }
|
|
288
|
+
.prefsitem { padding:6px 9px; border-radius:7px; cursor:pointer; font-size:12.5px; display:flex; align-items:center; gap:6px; }
|
|
289
|
+
/* The filename is the ONLY element that shrinks/truncates -- min-width:0 is load-bearing in a
|
|
290
|
+
flex row (without it a child never shrinks below its content size, so overflow:hidden does
|
|
291
|
+
nothing and the row just clips everything past the sidebar edge, size span included). The
|
|
292
|
+
size/badge stay flex-shrink:0 so they are always visible regardless of filename length. */
|
|
293
|
+
.prefsitem .prefsitemname { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
294
|
+
.prefsitem:hover { background:var(--hover-soft); } .prefsitem.sel { background:var(--sel-soft); color:var(--accent); } .prefsitem .size { color:var(--muted); font-size:11px; flex-shrink:0; } .prefsitem .ffbadge { color:var(--accent); font-size:10px; font-weight:600; flex-shrink:0; }
|
|
295
|
+
.prefsitem.kbd { outline:2px solid var(--accent); outline-offset:-2px; }
|
|
296
|
+
/* Near-empty files (a handful of scalar entries at most) fade back so attention goes to the
|
|
297
|
+
files actually worth opening; still fully visible and clickable, just de-emphasized. */
|
|
298
|
+
.prefsitem.tiny { color:var(--muted); } .prefsitem.tiny .size { opacity:.7; }
|
|
299
|
+
.prefsmain { flex:1; min-width:0; display:flex; flex-direction:column; }
|
|
300
|
+
/* The search bar gets its own bordered/tinted container, set apart from the results below it
|
|
301
|
+
(.prefsout), so it reads as "search every file" rather than looking like a header row glued
|
|
302
|
+
to whichever file happens to be selected. */
|
|
303
|
+
.prefssearchbar { background:var(--surface-2); border:1px solid var(--border); border-radius:10px; padding:9px 11px; margin-bottom:10px; }
|
|
304
|
+
.prefssearchlabel { color:var(--muted); font-size:10px; text-transform:uppercase; letter-spacing:.06em; margin-bottom:6px; }
|
|
305
|
+
.prefssearch { display:flex; gap:8px; }
|
|
306
|
+
.prefssearch 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; } .prefssearch input:focus { outline:none; border-color:var(--accent); }
|
|
307
|
+
.prefssearch button { background:var(--accent-bg); border:1px solid var(--accent); color:var(--accent-text); border-radius:8px; padding:0 16px; font:inherit; font-size:12.5px; font-weight:600; cursor:pointer; display:flex; align-items:center; gap:6px; }
|
|
308
|
+
.prefssearch button:disabled { opacity:.7; cursor:default; }
|
|
309
|
+
.spinner { display:inline-block; width:11px; height:11px; border:2px solid currentColor; border-right-color:transparent; border-radius:50%; animation:prefsspin .7s linear infinite; }
|
|
310
|
+
@keyframes prefsspin { to { transform:rotate(360deg); } }
|
|
311
|
+
.prefsmeta { color:var(--muted); font-size:11.5px; margin-bottom:8px; }
|
|
312
|
+
.prefsprivacy { background:var(--lvl-warn-bg); border:1px solid var(--warn); color:var(--warn-2); border-radius:8px; padding:8px 11px; font-size:11.5px; line-height:1.5; margin-bottom:10px; }
|
|
313
|
+
.prefsprofile { color:var(--blue-2); font-size:11.5px; margin-bottom:8px; } .prefsprofile b { color:var(--text); }
|
|
314
|
+
.prefsprofcap { color:var(--muted); text-transform:uppercase; letter-spacing:.06em; font-size:10px; }
|
|
315
|
+
.prefsprofile select { background:var(--surface); border:1px solid var(--border-2); border-radius:6px; color:var(--text); padding:3px 6px; font:inherit; font-size:11px; margin-left:4px; }
|
|
316
|
+
.prefsrefresh { background:var(--surface); border:1px solid var(--border-3); border-radius:6px; color:var(--muted-2); padding:2px 8px; font:inherit; font-size:11px; cursor:pointer; margin-left:8px; } .prefsrefresh:hover { border-color:var(--accent); color:var(--accent); }
|
|
317
|
+
.prefsout { flex:1; overflow:auto; border:1px solid var(--border); border-radius:10px; }
|
|
318
|
+
.prefsout table { border-collapse:collapse; width:100%; font-size:12px; }
|
|
319
|
+
.prefsout th { position:sticky; top:0; background:var(--surface); color:var(--muted-2); text-align:left; padding:7px 10px; border-bottom:1px solid var(--border); white-space:nowrap; }
|
|
320
|
+
.prefsout td { padding:6px 10px; border-bottom:1px solid var(--rowline); max-width:380px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; } .prefsout td.val { font-family:monospace; font-size:11.5px; cursor:pointer; }
|
|
321
|
+
.prefsout tr:hover td { background:var(--hover); }
|
|
322
|
+
.prefsout td.val:hover { color:var(--accent); }
|
|
323
|
+
.prefsout td.val.open { color:var(--accent); font-weight:600; }
|
|
324
|
+
/* Expanded value row: a full pretty-printed value below the clicked row, for values the
|
|
325
|
+
column truncates (JSON blobs like navigation_history/experiment_data routinely run past
|
|
326
|
+
380px with no other way to read or select the rest). */
|
|
327
|
+
.valexpand td { background:var(--surface-2); padding:10px; border-bottom:1px solid var(--rowline); white-space:normal; max-width:none; }
|
|
328
|
+
.valexpandbar { display:flex; gap:8px; margin-bottom:8px; }
|
|
329
|
+
.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); }
|
|
330
|
+
.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; }
|
|
331
|
+
.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; }
|
|
332
|
+
/* Stronger treatment for the "no matches" case where files were skipped -- a search that
|
|
333
|
+
could not read anything is a different severity than one that read everything and found
|
|
334
|
+
nothing, so it must not share the same quiet blue "fyi" styling as a partial skip. */
|
|
335
|
+
.truncwarn.err { background:var(--lvl-warn-bg); border-color:var(--warn); color:var(--warn-2); }
|
|
336
|
+
.searchgroup { margin-bottom:16px; }
|
|
337
|
+
.searchfile { color:var(--muted-2); font-size:11px; font-weight:600; padding:6px 10px; background:var(--surface); border-radius:6px; margin-bottom:8px; }
|
|
233
338
|
.msg { color:var(--muted); font-size:12px; padding:10px; } .msg.err { color:var(--error); }
|
|
339
|
+
/* feature flags (source:"flags") -- reuses .dbout for the table */
|
|
340
|
+
.flagsview { display:flex; flex-direction:column; gap:10px; max-width:1180px; margin-top:8px; height:72vh; }
|
|
341
|
+
.flagsbar { display:flex; gap:10px; align-items:center; }
|
|
342
|
+
/* the filter input fills the row like the feed's, and shares the feedbar input styling */
|
|
343
|
+
.flagsbar .ffilterwrap { flex:1; min-width:140px; }
|
|
344
|
+
.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); }
|
|
345
|
+
.flagsmeta { color:var(--muted); font-size:11.5px; white-space:nowrap; }
|
|
346
|
+
.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); }
|
|
347
|
+
.flagsview .dbout th.val, .flagsview .dbout td.val { width:90px; }
|
|
348
|
+
.flagsview .dbout th.origin, .flagsview .dbout td.origin { width:160px; }
|
|
349
|
+
.flagsview .dbout td.key { font-family:ui-monospace,Menlo,Consolas,monospace; color:var(--text); }
|
|
350
|
+
.flagval { font-variant-numeric:tabular-nums; font-weight:600; }
|
|
351
|
+
.flagval.on { color:var(--accent); } .flagval.off { color:var(--muted); } .flagval.dim { opacity:.55; font-weight:400; }
|
|
352
|
+
.flagval.variant { font-variant-numeric:normal; font-family:ui-monospace,Menlo,Consolas,monospace; font-size:11.5px; }
|
|
353
|
+
.flagsview .dbout tr.overridden td { background:var(--hover); }
|
|
354
|
+
/* live observer patch: briefly highlight a row whose value just changed */
|
|
355
|
+
.flagsview .dbout tr.flash td { animation:flagflash 1.2s ease-out; }
|
|
356
|
+
@keyframes flagflash { from { background:var(--accent-bg); } to { background:transparent; } }
|
|
357
|
+
.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); }
|
|
358
|
+
.orbadge.or-server { color:var(--accent); border-color:var(--accent); }
|
|
359
|
+
.orbadge.or-override { color:#ffb454; border-color:#ffb454; }
|
|
234
360
|
/* screen overlay */
|
|
235
361
|
#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; }
|
|
236
362
|
#screenpanel .schead { display:flex; align-items:center; gap:8px; margin-bottom:10px; }
|
|
@@ -8,12 +8,15 @@ import { html } from "./html.js";
|
|
|
8
8
|
import { render } from "preact";
|
|
9
9
|
import { useState, useEffect, useCallback } from "preact/hooks";
|
|
10
10
|
import { useStoreValue } from "./hooks.js";
|
|
11
|
-
import { store, MODES, describeConstraints } from "./store.js";
|
|
11
|
+
import { store, MODES, modeServed, describeConstraints } from "./store.js";
|
|
12
|
+
import { SOURCES } from "./registry.js";
|
|
12
13
|
import { Feed } from "./feed.js";
|
|
13
14
|
import { Cards } from "./widgets.js";
|
|
14
15
|
import { Inspector } from "./inspector.js";
|
|
15
16
|
import { Filters } from "./filters.js";
|
|
16
17
|
import { DbBrowser } from "./db.js";
|
|
18
|
+
import { FlagsBrowser } from "./flags.js";
|
|
19
|
+
import { PrefsBrowser } from "./prefs.js";
|
|
17
20
|
import { ScreenOverlay } from "./screen.js";
|
|
18
21
|
function readTheme() {
|
|
19
22
|
try {
|
|
@@ -23,9 +26,35 @@ function readTheme() {
|
|
|
23
26
|
return "dark";
|
|
24
27
|
}
|
|
25
28
|
}
|
|
29
|
+
// Header device picker. With 2+ attached devices it is a dropdown of the ready ones (state
|
|
30
|
+
// "device"), current one selected; picking one pins it via store.selectDevice. With 0 or 1
|
|
31
|
+
// device it is a plain chip (the bound label, or "none"). Mirrors the DB browser's profile
|
|
32
|
+
// chip/select pattern (.dbprofile) rather than reinventing markup.
|
|
33
|
+
function DeviceChip() {
|
|
34
|
+
const devices = useStoreValue(store, "devices", () => store.devices);
|
|
35
|
+
const ready = devices.filter((d) => d.state === "device");
|
|
36
|
+
const selected = store.selectedDevice;
|
|
37
|
+
// Unpinned with exactly one ready device: bare adb targets that device anyway, so name it
|
|
38
|
+
// instead of claiming "none". "none" is reserved for genuinely nothing attached.
|
|
39
|
+
const label = selected?.label ?? (ready.length === 1 ? ready[0].label : "none");
|
|
40
|
+
// A device-select failure (e.g. an ambiguous /enable 409). Shown in warn styling next to the
|
|
41
|
+
// picker, which stays usable so the user can pick a valid device (a successful pick clears it).
|
|
42
|
+
const deviceError = store.deviceError;
|
|
43
|
+
if (store.devicesError) {
|
|
44
|
+
return html `<span class="profilewrap" title="adb devices failed; check adb">device: <b>adb error</b></span>`;
|
|
45
|
+
}
|
|
46
|
+
const picker = ready.length < 2
|
|
47
|
+
? html `<b>${label}</b>`
|
|
48
|
+
: html `<select onChange=${(e) => store.selectDevice(e.currentTarget.value)}>
|
|
49
|
+
${!selected ? html `<option value="" selected disabled>pick a device…</option>` : null}
|
|
50
|
+
${ready.map((d) => html `<option value=${d.serial} selected=${d.serial === selected?.serial}>${d.label} (${d.serial})</option>`)}
|
|
51
|
+
</select>`;
|
|
52
|
+
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
|
+
}
|
|
26
54
|
function Header({ screenOpen, onScreenToggle }) {
|
|
27
55
|
const conn = useStoreValue(store, "conn", () => store.conn);
|
|
28
56
|
const profile = useStoreValue(store, "profile", () => store.profileLabel);
|
|
57
|
+
const version = useStoreValue(store, "version", () => store.serverVersion);
|
|
29
58
|
const [busy, setBusy] = useState(false);
|
|
30
59
|
const [theme, setTheme] = useState(readTheme);
|
|
31
60
|
const reconnect = useCallback(async () => {
|
|
@@ -50,20 +79,36 @@ function Header({ screenOpen, onScreenToggle }) {
|
|
|
50
79
|
SLACK RADAR DASHBOARD
|
|
51
80
|
<span class=${"conn " + conn.state}>${connected ? "● live" : "● " + (conn.msg || "reconnecting…")}</span>
|
|
52
81
|
<span class="profilewrap" title="the device profile Radar is connected to (first app to launch wins the socket)">profile: <b>${profile}</b></span>
|
|
82
|
+
<${DeviceChip} />
|
|
53
83
|
${!connected ? html `<button class="reconnect" disabled=${busy} onClick=${reconnect}>${busy ? "⟳ enabling…" : "⟳ Reconnect Radar"}</button>` : null}
|
|
54
84
|
<button class="themebtn" onClick=${toggleTheme} title="Toggle light / dark theme">${theme === "light" ? "🌙 Dark" : "☀ Light"}</button>
|
|
55
85
|
<button class=${"screenbtn" + (screenOpen ? " on" : "")} onClick=${onScreenToggle} title="Mirror the live device screen">▣ Screen</button>
|
|
86
|
+
${version ? html `<span class="version" title="Version of the dashboard process. It can differ from your Claude Code MCP session if a dashboard from an earlier launch still holds the port; restart the dashboard to match.">v${version}</span>` : null}
|
|
56
87
|
</h1>
|
|
57
88
|
`;
|
|
58
89
|
}
|
|
59
90
|
function ModeBar() {
|
|
60
91
|
const [, force] = useState(0);
|
|
61
92
|
useEffect(() => store.on("spec", () => force((n) => n + 1)), []);
|
|
93
|
+
const deviceSources = useStoreValue(store, "sources", () => store.deviceSources);
|
|
62
94
|
const activeKey = store.activeModeKey();
|
|
63
95
|
const pick = (specToPush) => store.setSpec(specToPush);
|
|
96
|
+
const serves = (m) => modeServed(m.key, deviceSources);
|
|
97
|
+
// A device switch can hide the active tab (leaner build). Reset to the first tab so the
|
|
98
|
+
// user is never stranded on an invisible mode rendering a dead feed.
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (activeKey && activeKey !== "__custom__" && !modeServed(activeKey, deviceSources)) {
|
|
101
|
+
store.setSpec(MODES[0].spec);
|
|
102
|
+
}
|
|
103
|
+
}, [deviceSources, activeKey]);
|
|
104
|
+
// Group modes by source kind for visual separation
|
|
105
|
+
const streamModes = MODES.filter((m) => serves(m) && SOURCES[m.spec.source]?.kind === "stream");
|
|
106
|
+
const stateModes = MODES.filter((m) => serves(m) && SOURCES[m.spec.source]?.kind === "state");
|
|
64
107
|
return html `
|
|
65
108
|
<div class="modebar">
|
|
66
|
-
${
|
|
109
|
+
${streamModes.map((m) => html `<button class=${"modebtn" + (activeKey === m.key ? " active" : "")} onClick=${() => pick(m.spec)}>${m.label}</button>`)}
|
|
110
|
+
${stateModes.length > 0 ? html `<span class="modedivider"></span>` : null}
|
|
111
|
+
${stateModes.map((m) => html `<button class=${"modebtn" + (activeKey === m.key ? " active" : "")} onClick=${() => pick(m.spec)}>${m.label}</button>`)}
|
|
67
112
|
${store.lastCustomSpec ? html `<button class=${"modebtn custom" + (activeKey === "__custom__" ? " active" : "")} title="pushed from a terminal Claude Code session; persists until refresh" onClick=${() => pick(store.lastCustomSpec)}>✎ ${store.lastCustomSpec.title || "Custom"}</button>` : null}
|
|
68
113
|
</div>
|
|
69
114
|
`;
|
|
@@ -142,6 +187,13 @@ function Blank() {
|
|
|
142
187
|
function App() {
|
|
143
188
|
const spec = useStoreValue(store, "spec", () => store.spec);
|
|
144
189
|
const [screenOpen, setScreenOpen] = useState(false);
|
|
190
|
+
// The DB and Prefs tabs cannot import the store (neither needs the SSE engine/timers a
|
|
191
|
+
// point-in-time browser has no use for), so neither can self-reset on a device change. The
|
|
192
|
+
// store emits "db-resync" on any bound-device change (first pin included, PR #94
|
|
193
|
+
// multi-device); folding that counter into each tab's key remounts it on a switch, which
|
|
194
|
+
// drops its picked-file/table/results state and re-fetches from the newly bound device. Name
|
|
195
|
+
// is a historical artifact (the DB tab needed this first); Prefs folds in the same counter.
|
|
196
|
+
const dbResync = useStoreValue(store, "db-resync", () => store.dbSerialVersion);
|
|
145
197
|
// The screen overlay is a fixed right-docked panel; widen the page padding while it is open so
|
|
146
198
|
// it never covers the feed/widgets.
|
|
147
199
|
useEffect(() => {
|
|
@@ -159,7 +211,8 @@ function App() {
|
|
|
159
211
|
if (e.key !== "ArrowRight" && e.key !== "ArrowLeft" && e.key !== "h" && e.key !== "l")
|
|
160
212
|
return;
|
|
161
213
|
const dir = e.key === "ArrowRight" || e.key === "l" ? 1 : -1;
|
|
162
|
-
|
|
214
|
+
// Same filter as the modebar, so the arrows cannot land on a hidden tab.
|
|
215
|
+
const keys = MODES.filter((m) => modeServed(m.key, store.deviceSources)).map((m) => m.key);
|
|
163
216
|
if (store.lastCustomSpec)
|
|
164
217
|
keys.push("__custom__");
|
|
165
218
|
let cur = keys.indexOf(store.activeModeKey() || "");
|
|
@@ -190,7 +243,32 @@ function App() {
|
|
|
190
243
|
<span class="summary">${spec.summary || "Device database browser"}</span>
|
|
191
244
|
<span class="tech">source=db (on-device SQLite snapshot, read-only)</span>
|
|
192
245
|
</div>
|
|
193
|
-
<${DbBrowser} spec=${spec} key
|
|
246
|
+
<${DbBrowser} spec=${spec} key=${"db-" + dbResync} />
|
|
247
|
+
`;
|
|
248
|
+
}
|
|
249
|
+
else if (spec.source === "flags") {
|
|
250
|
+
// Feature Flags: a self-contained, point-in-time container like the DB browser (no store /
|
|
251
|
+
// SSE engine). key=flags so it remounts cleanly when switching to the tab.
|
|
252
|
+
view = html `
|
|
253
|
+
<div class="sub">
|
|
254
|
+
<span class="summary">${spec.summary || "Feature flags"}</span>
|
|
255
|
+
<span class="tech">source=flags (live snapshot from the running app)</span>
|
|
256
|
+
</div>
|
|
257
|
+
<${FlagsBrowser} key="flags" />
|
|
258
|
+
`;
|
|
259
|
+
}
|
|
260
|
+
else if (spec.source === "prefs") {
|
|
261
|
+
// The Prefs browser is a self-contained, point-in-time container: it does NOT import the store
|
|
262
|
+
// (no SSE engine / timers on a tab that has no live feed). key folds in dbResync (PR #94
|
|
263
|
+
// multi-device: the same store event the DB tab remounts on) so a device switch also
|
|
264
|
+
// remounts Prefs -- without it Prefs kept the OLD device's files/entries on screen after
|
|
265
|
+
// switching, since its own useEffect only fetches once on initial mount.
|
|
266
|
+
view = html `
|
|
267
|
+
<div class="sub">
|
|
268
|
+
<span class="summary">${spec.summary || "Device preferences browser"}</span>
|
|
269
|
+
<span class="tech">source=prefs (on-device SharedPreferences snapshot, read-only)</span>
|
|
270
|
+
</div>
|
|
271
|
+
<${PrefsBrowser} spec=${spec} key=${"prefs-" + dbResync} />
|
|
194
272
|
`;
|
|
195
273
|
}
|
|
196
274
|
else {
|