@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.
- package/README.md +114 -18
- package/dist/mcp/api-paths.d.ts +2 -2
- package/dist/mcp/api-paths.js +4 -19
- package/dist/mcp/dashboard-identity.d.ts +6 -0
- package/dist/mcp/dashboard-identity.js +11 -0
- package/dist/mcp/index.js +210 -145
- package/dist/mcp/logs-result.d.ts +1 -0
- package/dist/mcp/logs-result.js +1 -0
- package/dist/mcp/radar-export-get.d.ts +30 -0
- package/dist/mcp/radar-export-get.js +49 -0
- package/dist/mcp/radar-http.d.ts +22 -0
- package/dist/mcp/radar-http.js +61 -0
- package/dist/mcp/radar-response.d.ts +5 -1
- package/dist/mcp/radar-response.js +8 -3
- package/dist/mcp/session-backfill.js +3 -4
- package/dist/mcp/session-enable.d.ts +15 -0
- package/dist/mcp/session-enable.js +268 -19
- package/dist/mcp/snapshot.js +42 -26
- package/dist/mcp/sources-gate.js +6 -0
- package/dist/mcp/stale-dashboard.d.ts +23 -0
- package/dist/mcp/stale-dashboard.js +122 -0
- package/dist/mcp/switchboard-spool.d.ts +12 -0
- package/dist/mcp/switchboard-spool.js +107 -0
- package/dist/mcp/switchboard-tools.d.ts +9 -0
- package/dist/mcp/switchboard-tools.js +144 -6
- package/dist/mcp/test-cases.d.ts +14 -0
- package/dist/mcp/test-cases.js +77 -0
- package/dist/mcp/test-runs-tools.d.ts +8 -0
- package/dist/mcp/test-runs-tools.js +95 -0
- package/dist/mcp/tools.d.ts +4 -1
- package/dist/mcp/tools.js +101 -21
- package/dist/mcp/web-child-env.d.ts +4 -1
- package/dist/mcp/web-child-env.js +4 -1
- package/dist/shared/android.d.ts +44 -0
- package/dist/shared/android.js +234 -24
- package/dist/shared/constants.d.ts +9 -4
- package/dist/shared/constants.js +9 -4
- package/dist/shared/feature-flags.d.ts +1 -0
- package/dist/shared/feature-flags.js +1 -0
- package/dist/shared/ios-logs.d.ts +10 -0
- package/dist/shared/ios-logs.js +91 -0
- package/dist/shared/ios.d.ts +25 -2
- package/dist/shared/ios.js +157 -3
- package/dist/{web → shared}/log-session.d.ts +45 -31
- package/dist/shared/log-session.js +300 -0
- package/dist/shared/logcat-capture.js +17 -1
- package/dist/shared/radar-request-raw.d.ts +7 -0
- package/dist/shared/radar-request-raw.js +89 -0
- package/dist/shared/radar-token.d.ts +25 -0
- package/dist/shared/radar-token.js +164 -0
- package/dist/shared/stream.d.ts +3 -0
- package/dist/shared/stream.js +107 -15
- package/dist/shared/switchboard-host-store.d.ts +21 -0
- package/dist/shared/switchboard-host-store.js +166 -0
- package/dist/shared/switchboard-note.d.ts +15 -0
- package/dist/shared/switchboard-note.js +92 -0
- package/dist/shared/switchboard-report-file.d.ts +5 -0
- package/dist/shared/switchboard-report-file.js +26 -0
- package/dist/shared/switchboard-report.d.ts +20 -0
- package/dist/shared/switchboard-report.js +406 -0
- package/dist/shared/switchboard.d.ts +111 -2
- package/dist/shared/switchboard.js +436 -3
- package/dist/shared/transport.d.ts +49 -3
- package/dist/shared/version.d.ts +2 -0
- package/dist/shared/version.js +18 -0
- package/dist/shared/wire.d.ts +14 -1
- package/dist/web/install-app.d.ts +75 -8
- package/dist/web/install-app.js +330 -67
- package/dist/web/macapp/RadarApp.swift +487 -23
- package/dist/web/public/index.html +51 -9
- package/dist/web/public/next/app.js +33 -18
- package/dist/web/public/next/feed.js +102 -15
- package/dist/web/public/next/flags.js +3 -0
- package/dist/web/public/next/inspector.js +69 -3
- package/dist/web/public/next/prefs.js +5 -2
- package/dist/web/public/next/registry.js +18 -5
- package/dist/web/public/next/store.js +455 -29
- package/dist/web/public/next/switchboard-note.js +93 -0
- package/dist/web/public/next/toast.js +9 -5
- package/dist/web/public/next/voice-model.js +215 -35
- package/dist/web/public/next/voice.js +173 -18
- package/dist/web/server.d.ts +15 -11
- package/dist/web/server.js +690 -168
- package/dist/web/spec.d.ts +2 -1
- package/dist/web/spec.js +2 -1
- package/package.json +2 -2
- package/dist/web/log-session.js +0 -166
|
@@ -7,7 +7,9 @@ import { html } from "./html.js";
|
|
|
7
7
|
import { useMemo, useRef, useState } from "preact/hooks";
|
|
8
8
|
import { useStorePulse } from "./hooks.js";
|
|
9
9
|
import { store } from "./store.js";
|
|
10
|
-
import {
|
|
10
|
+
import { showToast } from "./toast.js";
|
|
11
|
+
import { capitalizeSwitchboardNote, SAVED_TURN_KEPT_OUTCOMES, savedTurnCountWord } from "./switchboard-note.js";
|
|
12
|
+
import { buildVoiceModel, CLIP_PEAK, dbfsHeight, GAP_P95_BAD_MS, phaseLabel, RATE_MIN_DIVISOR_MS, tickStepMs, ZOOMS } from "./voice-model.js";
|
|
11
13
|
// The stream view draws the panel only on the Switchboard tab and only while the spec keeps the
|
|
12
14
|
// voice key, so a custom spec on that source can leave it out.
|
|
13
15
|
export function showsVoicePanel(spec) {
|
|
@@ -19,9 +21,14 @@ export function showsVoicePanel(spec) {
|
|
|
19
21
|
// plain HTML over the plot rather than inside the SVG: SVG text at a fixed font-size would
|
|
20
22
|
// stretch or squash with the x scale, and a stretched glyph reads as a bug, not a chart.
|
|
21
23
|
const W = 1000;
|
|
22
|
-
const
|
|
23
|
-
const ROW_Y = { model: 12, you: 40, mark: 80 };
|
|
24
|
+
const ROW_Y = { model: 12, you: 40, mark: 80, micLevel: 108, playbackLevel: 140 };
|
|
24
25
|
const ROW_H = 18;
|
|
26
|
+
const LEVEL_ROW_H = 24;
|
|
27
|
+
// Matches .voice-ticklabels' height in index.html.
|
|
28
|
+
const TICK_BAND_H = 12;
|
|
29
|
+
function plotHeight(hasLevels) {
|
|
30
|
+
return hasLevels ? ROW_Y.playbackLevel + LEVEL_ROW_H + TICK_BAND_H : ROW_Y.mark + ROW_H + TICK_BAND_H;
|
|
31
|
+
}
|
|
25
32
|
// Markers (and, separately, model/you/muted segments) that land within this many viewBox units
|
|
26
33
|
// of each other (1/1000 of the width) collapse into one glyph, at every zoom, not just the
|
|
27
34
|
// whole-session one: a burst of re-arms a few frames apart is exactly as unreadable crammed into
|
|
@@ -68,6 +75,76 @@ function dotClass(state) {
|
|
|
68
75
|
return "";
|
|
69
76
|
return "warn";
|
|
70
77
|
}
|
|
78
|
+
// navigator.clipboard is absent in some embedded WebViews.
|
|
79
|
+
function copyServerSessionId(id) {
|
|
80
|
+
const clip = navigator.clipboard;
|
|
81
|
+
if (!clip?.writeText) {
|
|
82
|
+
showToast("copy not available in this browser");
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
clip.writeText(id).then(() => showToast("server session id copied"), () => showToast("copy failed"));
|
|
86
|
+
}
|
|
87
|
+
// A hidden iframe navigation, as screen.ts does: in the dock app's WKWebView an <a> click or a
|
|
88
|
+
// Blob URL cannot save, while a Content-Disposition: attachment response can.
|
|
89
|
+
function triggerSwitchboardDownload(url) {
|
|
90
|
+
let frame = document.getElementById("sbdlframe");
|
|
91
|
+
if (!frame) {
|
|
92
|
+
frame = document.createElement("iframe");
|
|
93
|
+
frame.id = "sbdlframe";
|
|
94
|
+
frame.style.display = "none";
|
|
95
|
+
document.body.appendChild(frame);
|
|
96
|
+
}
|
|
97
|
+
frame.src = url;
|
|
98
|
+
}
|
|
99
|
+
// An all-caps first word (HTTP, ECONNREFUSED) is a code, so it keeps its case.
|
|
100
|
+
function lowerFirstLetterUnlessAllCapsWord(reason) {
|
|
101
|
+
if (reason.length === 0)
|
|
102
|
+
return reason;
|
|
103
|
+
const firstWord = reason.split(/\s/, 1)[0];
|
|
104
|
+
if (/[A-Z]/.test(firstWord) && firstWord === firstWord.toUpperCase())
|
|
105
|
+
return reason;
|
|
106
|
+
return reason.charAt(0).toLowerCase() + reason.slice(1);
|
|
107
|
+
}
|
|
108
|
+
// A reason starting "Failed to ..." folds in ("export failed to build ...") instead of doubling
|
|
109
|
+
// "failed".
|
|
110
|
+
function exportFailedToast(reason) {
|
|
111
|
+
const lowered = lowerFirstLetterUnlessAllCapsWord(reason);
|
|
112
|
+
if (/^failed\b/i.test(reason))
|
|
113
|
+
return `export ${lowered}`;
|
|
114
|
+
return `export failed: ${lowered}`;
|
|
115
|
+
}
|
|
116
|
+
// The route answers with a download URL, not the report body, since an iframe navigation cannot
|
|
117
|
+
// read a POST response.
|
|
118
|
+
async function exportSwitchboardSession(sessionId) {
|
|
119
|
+
try {
|
|
120
|
+
const res = await fetch("/switchboard/export", {
|
|
121
|
+
method: "POST",
|
|
122
|
+
headers: store.authoredHeaders({ "Content-Type": "application/json" }),
|
|
123
|
+
body: JSON.stringify({ id: sessionId }),
|
|
124
|
+
});
|
|
125
|
+
const body = await res.json().catch(() => null);
|
|
126
|
+
if (!res.ok || !body?.download) {
|
|
127
|
+
// "HTTP 502", not a bare "502", which would read like a session id.
|
|
128
|
+
const reason = body && typeof body.error === "string" ? body.error : `HTTP ${res.status}`;
|
|
129
|
+
showToast(exportFailedToast(reason));
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
triggerSwitchboardDownload(body.download);
|
|
133
|
+
// Not showSaveToast: reveal-in-Finder needs a download-finished match this filename was
|
|
134
|
+
// never confirmed against.
|
|
135
|
+
const notes = Array.isArray(body.notes) ? body.notes : [];
|
|
136
|
+
const firstNote = typeof notes[0] === "string" ? notes[0] : null;
|
|
137
|
+
const capitalizedNote = firstNote ? capitalizeSwitchboardNote(firstNote) : null;
|
|
138
|
+
// Longer duration: the note is a whole extra sentence to read.
|
|
139
|
+
if (capitalizedNote)
|
|
140
|
+
showToast(`report downloading. ${capitalizedNote}`, 9000);
|
|
141
|
+
else
|
|
142
|
+
showToast("report downloading");
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
showToast("export failed: request did not complete");
|
|
146
|
+
}
|
|
147
|
+
}
|
|
71
148
|
function micClass(state) {
|
|
72
149
|
if (state === "Capturing")
|
|
73
150
|
return "ok";
|
|
@@ -80,22 +157,28 @@ function micClass(state) {
|
|
|
80
157
|
export function VoicePanel({ onInspect, now = () => Date.now() }) {
|
|
81
158
|
useStorePulse(store, "tick");
|
|
82
159
|
const [zoom, setZoom] = useState("60s");
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
//
|
|
160
|
+
// One export at a time: each POST writes its own file server-side.
|
|
161
|
+
const [exporting, setExporting] = useState(false);
|
|
162
|
+
// The store keeps the newest run's rows (the ones the Switchboard feed shows) and hands back the
|
|
163
|
+
// same array until they change, so a render does not touch the shared cache and the model is
|
|
164
|
+
// rebuilt only when that array, the zoom or the run's server id changes. A live session also
|
|
165
|
+
// rebuilds once a second: its window slides with the clock. An ended session's does not (the
|
|
166
|
+
// model closes at the end record, wherever the clock is), so the clock leaves the key once the
|
|
167
|
+
// session ends.
|
|
89
168
|
const ended = useRef(false);
|
|
90
|
-
const rows = store.
|
|
91
|
-
const
|
|
92
|
-
const
|
|
169
|
+
const rows = store.switchboardRunRows();
|
|
170
|
+
const sid = store.switchboardNewestSessionId();
|
|
171
|
+
const summaryServerSessionId = sid !== null ? store.switchboardSummaryServerId(sid) : undefined;
|
|
172
|
+
const summarySavedTurnCounts = sid !== null ? store.switchboardSummarySavedTurnCounts(sid) : undefined;
|
|
173
|
+
// Mutated in place as saved_turn rows land; each new one of the drawn run also lands in `rows`,
|
|
174
|
+
// which rebuilds the model.
|
|
175
|
+
const savedTurnOutcomes = sid !== null ? store.switchboardSavedTurnOutcomes(sid) : undefined;
|
|
93
176
|
const clockKey = ended.current ? 0 : Math.floor(now() / 1000);
|
|
94
177
|
const m = useMemo(() => {
|
|
95
|
-
const model = buildVoiceModel(rows, zoom, now());
|
|
178
|
+
const model = buildVoiceModel(rows, zoom, now(), summaryServerSessionId, summarySavedTurnCounts, savedTurnOutcomes);
|
|
96
179
|
ended.current = model !== null && model.ended;
|
|
97
180
|
return model;
|
|
98
|
-
}, [
|
|
181
|
+
}, [rows, zoom, summaryServerSessionId, summarySavedTurnCounts, savedTurnOutcomes, clockKey]);
|
|
99
182
|
// Records exist but none names a session, or there is no switchboard record at all: draw
|
|
100
183
|
// nothing. The feed's own empty state already tells the person what to do next.
|
|
101
184
|
if (!m)
|
|
@@ -125,8 +208,24 @@ export function VoicePanel({ onInspect, now = () => Date.now() }) {
|
|
|
125
208
|
<div class="voice-card">
|
|
126
209
|
<div class="voice-hd">
|
|
127
210
|
<span>${zoomTitle}${rearms > 0 ? html ` · <span class=${"voice-hd-rearms" + (rearmsStarved > 0 ? " warn" : "")}>${rearms} ${rearms === 1 ? "re-arm" : "re-arms"}</span>` : null}</span>
|
|
128
|
-
<span class="voice-
|
|
129
|
-
|
|
211
|
+
<span class="voice-hd-tools">
|
|
212
|
+
<span class="voice-zoom" role="group" aria-label="tracks window">
|
|
213
|
+
${ZOOMS.map((o) => html `<button type="button" class=${"voice-zoombtn" + (o.key === zoom ? " on" : "")} aria-pressed=${o.key === zoom ? "true" : "false"} onClick=${() => setZoom(o.key)}>${o.label}</button>`)}
|
|
214
|
+
</span>
|
|
215
|
+
<button
|
|
216
|
+
type="button"
|
|
217
|
+
class="voice-exportbtn"
|
|
218
|
+
aria-disabled=${exporting ? "true" : "false"}
|
|
219
|
+
aria-busy=${exporting ? "true" : "false"}
|
|
220
|
+
title="download this session as a text report, with every record the device still holds"
|
|
221
|
+
onClick=${() => {
|
|
222
|
+
// aria-disabled, not disabled, so the button stays in the tab order mid-export.
|
|
223
|
+
if (exporting)
|
|
224
|
+
return;
|
|
225
|
+
setExporting(true);
|
|
226
|
+
void exportSwitchboardSession(m.sessionId).finally(() => setExporting(false));
|
|
227
|
+
}}
|
|
228
|
+
>${exporting ? "exporting…" : "export"}</button>
|
|
130
229
|
</span>
|
|
131
230
|
</div>
|
|
132
231
|
<${Tracks} m=${m} title=${zoomTitle} rearms=${rearms} onPick=${onInspect} />
|
|
@@ -156,6 +255,18 @@ function SessionStrip({ m }) {
|
|
|
156
255
|
<span class="voice-kv">session <b>${String(m.sessionId)}</b></span>
|
|
157
256
|
<span class="voice-pill"><i class=${"voice-dot " + micClass(m.mic?.to)} aria-hidden="true"></i>mic ${m.mic ? m.mic.to : "unknown"}</span>
|
|
158
257
|
<span class="voice-pill"><i class=${"voice-dot " + (m.speaking?.to === "speaking" ? "ok" : "")} aria-hidden="true"></i>model ${m.speaking ? m.speaking.to : "unknown"}</span>
|
|
258
|
+
${m.serverSession.id
|
|
259
|
+
? html `<button type="button" class="voice-pill voice-pill-server" title="server session id, click to copy" onClick=${() => copyServerSessionId(m.serverSession.id)}>server <b>${m.serverSession.id}</b></button>`
|
|
260
|
+
: m.serverSession.pending
|
|
261
|
+
? html `<span class="voice-pill voice-pill-server voice-note" title="waiting on the device's session.ready record">server id pending</span>`
|
|
262
|
+
: m.savedTurns?.some((c) => c.outcome === "other_session" && c.count > 0)
|
|
263
|
+
? m.serverSessionNone
|
|
264
|
+
? html `<span class="voice-pill voice-pill-server voice-note" title="the device's ready record named no server session id, which usually explains the turns dropped as other session">no server id</span>`
|
|
265
|
+
: html `<span class="voice-pill voice-pill-server voice-note" title="this tab knows no server session id for the session, and some turns dropped as other session; the device may never have had one, or its ready record aged out of this tab, so check get_switchboard_session before reading the drops as a missing id">server id unknown</span>`
|
|
266
|
+
: null}
|
|
267
|
+
${m.savedTurns
|
|
268
|
+
? html `<span class=${"voice-kv" + (m.savedTurns.some((c) => !SAVED_TURN_KEPT_OUTCOMES.includes(c.outcome) && c.count > 0) ? " warn" : "")} title="what happened to each spoken turn, by outcome: the device count when this tab loaded the session, plus the turns seen since (or the turns this tab has seen, when those are more); saved (line moved on) is a late save whose line already moved on, still kept; the dropped ones, and any outcome this dashboard does not know, are the ones to look into">turns ${m.savedTurns.map((c, i) => html `${i ? " · " : ""}${savedTurnCountWord(c.outcome)} <b>${c.count}</b>`)}</span>`
|
|
269
|
+
: null}
|
|
159
270
|
<span class="voice-kv" title=${`outgoing frames per second over the ${m.ended ? "last 10 s before the session ended" : "last 10 s"}, or the session's own age when younger, counting ${m.uplink.rule} frames`}>uplink <b>${m.uplink.perSec.toFixed(1)}/s</b> ${m.uplink.rule === "audio" ? "audio frames" : "frames"}${m.ended ? " at close" : ""}</span>
|
|
160
271
|
<span class=${"voice-kv" + (downlinkWarn ? " warn" : "")} title=${`incoming ${m.downlink.rule === "audio" ? "audio frames" : "frames"} per second over the ${m.ended ? "last 10 s before the session ended" : "last 10 s"}, or the session's own age when younger; 0 while the model is speaking and the session is older than ${RATE_MIN_DIVISOR_MS / 1000} s means no audio frames are arriving`}>downlink <b>${m.downlink.perSec.toFixed(1)}/s</b> ${m.downlink.rule === "audio" ? "audio frames" : "frames"}${m.ended ? " at close" : ""}</span>
|
|
161
272
|
</div>
|
|
@@ -241,7 +352,41 @@ function mergeSegmentsByColumn(segs, x) {
|
|
|
241
352
|
}
|
|
242
353
|
return out;
|
|
243
354
|
}
|
|
355
|
+
// Keeps the loudest sample per column rather than averaging, so a brief spike survives a
|
|
356
|
+
// whole-session zoom.
|
|
357
|
+
function bucketLevelPoints(points, x) {
|
|
358
|
+
const byCol = new Map();
|
|
359
|
+
for (const p of points) {
|
|
360
|
+
const col = Math.round(x(p.t) / COLLAPSE_COL);
|
|
361
|
+
const cur = byCol.get(col);
|
|
362
|
+
if (!cur) {
|
|
363
|
+
byCol.set(col, p);
|
|
364
|
+
}
|
|
365
|
+
else if (p.rms > cur.rms || p.peak > cur.peak) {
|
|
366
|
+
byCol.set(col, { t: cur.t, rms: Math.max(p.rms, cur.rms), peak: Math.max(p.peak, cur.peak) });
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return [...byCol.values()].sort((a, b) => a.t - b.t);
|
|
370
|
+
}
|
|
371
|
+
// Bars, not a connected line, so a gap between batches does not draw a misleading slope. The
|
|
372
|
+
// clip cap is full opacity because the .3-opacity peak bar alone is easy to miss.
|
|
373
|
+
const CLIP_CAP_H = 2.5;
|
|
374
|
+
function levelBars(points, y, h, x, colour, rowClass) {
|
|
375
|
+
const bucketed = bucketLevelPoints(points, x);
|
|
376
|
+
return bucketed.map((p) => {
|
|
377
|
+
const cx = x(p.t);
|
|
378
|
+
const peakH = Math.max(1, dbfsHeight(p.peak) * h);
|
|
379
|
+
const rmsH = Math.max(1, dbfsHeight(p.rms) * h);
|
|
380
|
+
const clipping = p.peak >= CLIP_PEAK;
|
|
381
|
+
return html `<g class=${rowClass}>
|
|
382
|
+
<rect class="voice-levelpeak" x=${cx - 1.5} y=${y + h - peakH} width="3" height=${peakH} fill=${clipping ? "var(--error)" : colour} opacity=".3" />
|
|
383
|
+
<rect class="voice-levelrms" x=${cx - 1} y=${y + h - rmsH} width="2" height=${rmsH} fill=${colour} opacity=".9" />
|
|
384
|
+
${clipping ? html `<rect class="voice-levelclip" x=${cx - 1.5} y=${y} width="3" height=${CLIP_CAP_H} fill="var(--error)" opacity="1" />` : null}
|
|
385
|
+
</g>`;
|
|
386
|
+
});
|
|
387
|
+
}
|
|
244
388
|
function Tracks({ m, title, rearms, onPick }) {
|
|
389
|
+
const H = plotHeight(m.hasLevels);
|
|
245
390
|
const { from, to } = m.window;
|
|
246
391
|
const span = Math.max(1, to - from);
|
|
247
392
|
const x = (t) => Math.min(W, Math.max(0, ((t - from) / span) * W));
|
|
@@ -270,6 +415,8 @@ function Tracks({ m, title, rearms, onPick }) {
|
|
|
270
415
|
// A burst reads differently from a plain mixed collapse: still one kind throughout, just more
|
|
271
416
|
// than one record of it landed in the same spot (see DrawMarker.multi).
|
|
272
417
|
const hasBurst = drawn.some((k) => k.multi && k.kind !== "mixed");
|
|
418
|
+
// A raw peak check matches what bucketing draws, since a bucket keeps its loudest sample.
|
|
419
|
+
const hasClipping = m.hasLevels && (m.micLevels.some((p) => p.peak >= CLIP_PEAK) || m.playbackLevels.some((p) => p.peak >= CLIP_PEAK));
|
|
273
420
|
const stalls = m.markers.filter((k) => k.kind === "stall").length;
|
|
274
421
|
const failures = m.markers.filter((k) => k.kind === "error").length;
|
|
275
422
|
const label = `voice tracks, ${title.toLowerCase()}, ${m.model.length} model ${m.model.length === 1 ? "turn" : "turns"}, ${rearms} ${rearms === 1 ? "re-arm" : "re-arms"}${stalls > 0 ? `, ${stalls} ${stalls === 1 ? "stall" : "stalls"}` : ""}${failures > 0 ? `, ${failures} ${failures === 1 ? "failure" : "failures"}` : ""}`;
|
|
@@ -295,9 +442,11 @@ function Tracks({ m, title, rearms, onPick }) {
|
|
|
295
442
|
<span style=${`top:${(ROW_Y.model / H) * 100}%`}>model</span>
|
|
296
443
|
<span style=${`top:${(ROW_Y.you / H) * 100}%`}>you</span>
|
|
297
444
|
<span style=${`top:${(ROW_Y.mark / H) * 100}%`}>markers</span>
|
|
445
|
+
${m.hasLevels ? html `<span style=${`top:${(ROW_Y.micLevel / H) * 100}%`} title="dBFS, -60 (bottom) to 0 (top); light is peak, solid is rms">mic level</span>` : null}
|
|
446
|
+
${m.hasLevels ? html `<span style=${`top:${(ROW_Y.playbackLevel / H) * 100}%`} title="dBFS, -60 (bottom) to 0 (top); light is peak, solid is rms">playback level</span>` : null}
|
|
298
447
|
</div>
|
|
299
448
|
<div class="voice-plot">
|
|
300
|
-
<svg viewBox=${`0 0 ${W} ${H}`} preserveAspectRatio="none" role="img" aria-label=${label}>
|
|
449
|
+
<svg viewBox=${`0 0 ${W} ${H}`} style=${`height:${H}px`} preserveAspectRatio="none" role="img" aria-label=${label}>
|
|
301
450
|
<defs>
|
|
302
451
|
<!-- Horizontal bands, not a rotated line: patternTransform skews under the SVG's
|
|
303
452
|
x-only stretch (preserveAspectRatio="none") the same way a plain shape would,
|
|
@@ -345,6 +494,8 @@ function Tracks({ m, title, rearms, onPick }) {
|
|
|
345
494
|
: null}
|
|
346
495
|
</g>`;
|
|
347
496
|
})}
|
|
497
|
+
${m.hasLevels ? levelBars(m.micLevels, ROW_Y.micLevel, LEVEL_ROW_H, x, "var(--accent)", "voice-miclevel") : null}
|
|
498
|
+
${m.hasLevels ? levelBars(m.playbackLevels, ROW_Y.playbackLevel, LEVEL_ROW_H, x, "var(--blue)", "voice-playbacklevel") : null}
|
|
348
499
|
</svg>
|
|
349
500
|
<div class="voice-ticklabels" aria-hidden="true">
|
|
350
501
|
${ticks.map((t) =>
|
|
@@ -355,7 +506,9 @@ function Tracks({ m, title, rearms, onPick }) {
|
|
|
355
506
|
html `<span style=${`left:${(t.x / W) * 100}%${t.x < 1 ? ";transform:none" : ""}`}>${t.label}</span>`)}
|
|
356
507
|
<span style="left:100%;transform:translateX(-100%)">${m.ended ? "end" : "now"}</span>
|
|
357
508
|
</div>
|
|
358
|
-
${drawn.length === 0
|
|
509
|
+
${drawn.length === 0
|
|
510
|
+
? html `<div class="voice-note voice-nomarkers" style=${`top:${(ROW_Y.mark / H) * 100}%`}>no markers in window</div>`
|
|
511
|
+
: null}
|
|
359
512
|
</div>
|
|
360
513
|
</div>
|
|
361
514
|
<div class="voice-legend">
|
|
@@ -367,8 +520,10 @@ function Tracks({ m, title, rearms, onPick }) {
|
|
|
367
520
|
<span class="st">player stall</span>
|
|
368
521
|
<span class="e">connection failed</span>
|
|
369
522
|
<span class="f">mic paused</span>
|
|
523
|
+
${hasClipping ? html `<span class="clip">clipping</span>` : null}
|
|
370
524
|
${hasMixed ? html `<span class="mx">multiple markers</span>` : null}
|
|
371
525
|
${hasBurst ? html `<span class="mb">burst (several at one spot, hover for the count)</span>` : null}
|
|
526
|
+
${m.hasLevels ? html `<span class="lv">level rows in dBFS (-60 to 0), light = peak, solid = rms</span>` : null}
|
|
372
527
|
</div>
|
|
373
528
|
</div>
|
|
374
529
|
`;
|
package/dist/web/server.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import http from "http";
|
|
2
2
|
import type { StatusReason } from "../shared/wire.js";
|
|
3
|
-
import { SWITCHBOARD_KIND, SWITCHBOARD_BACKFILL_DEADLINE_MS, SWITCHBOARD_BACKFILL_SESSIONS } from "../shared/switchboard.js";
|
|
3
|
+
import { SWITCHBOARD_KIND, SWITCHBOARD_BACKFILL_DEADLINE_MS, SWITCHBOARD_BACKFILL_SESSIONS, type SwitchboardExportGet } from "../shared/switchboard.js";
|
|
4
4
|
import { type DashboardScreenController } from "../shared/dashboard-screen.js";
|
|
5
5
|
import type { ProcessState } from "../shared/transport.js";
|
|
6
|
-
import { type LogFrame } from "./log-session.js";
|
|
7
6
|
declare const WEB_PORT: number;
|
|
8
7
|
/**
|
|
9
8
|
* Decide whether to drop a log frame under backpressure. LIVE frames are dropped
|
|
@@ -323,10 +322,12 @@ export declare const DEVICE_SOURCES: Record<string, {
|
|
|
323
322
|
}>;
|
|
324
323
|
export { SWITCHBOARD_KIND, SWITCHBOARD_BACKFILL_SESSIONS, SWITCHBOARD_BACKFILL_DEADLINE_MS };
|
|
325
324
|
export declare const BACKFILL_ROUTE_HEADROOM_MS = 250;
|
|
326
|
-
export declare function fetchSwitchboardBackfill(limit: number, deadlineMs?:
|
|
325
|
+
export declare function fetchSwitchboardBackfill(limit: number, deadlineMs: number, forwarded: boolean, onUnauthorized?: () => void): Promise<{
|
|
327
326
|
type: string;
|
|
328
327
|
event: Record<string, unknown>;
|
|
329
328
|
}[]>;
|
|
329
|
+
export declare const _switchboardExportGetForTest: SwitchboardExportGet;
|
|
330
|
+
export declare function _setSwitchboardExportStaleMsForTest(ms: number): void;
|
|
330
331
|
/**
|
|
331
332
|
* Finish a /detail proxy response after an upstream error or timeout. The success
|
|
332
333
|
* callback streams the upstream response, so headers may already be sent when a later
|
|
@@ -336,17 +337,20 @@ export declare function fetchSwitchboardBackfill(limit: number, deadlineMs?: num
|
|
|
336
337
|
* have not gone out yet; otherwise just end the already-started response. Exported for tests.
|
|
337
338
|
*/
|
|
338
339
|
export declare function failDetailResponse(res: Pick<http.ServerResponse, "headersSent" | "writeHead" | "end">, status: number): void;
|
|
339
|
-
type ParsedLog = LogFrame;
|
|
340
|
-
/**
|
|
341
|
-
* Parse one `adb logcat -v threadtime` line into a structured event, or null if it does
|
|
342
|
-
* not match the format. `resolvePkg` maps a pid to its package name (defaults to the
|
|
343
|
-
* live adb-backed resolver); injectable so this stays a pure, unit-testable function.
|
|
344
|
-
* Exported for tests.
|
|
345
|
-
*/
|
|
346
|
-
export declare function parseLogcat(line: string, resolvePkg?: (pid: number) => string | undefined): ParsedLog | null;
|
|
347
340
|
export declare function _setStreamResponseTimeoutForTest(ms: number | null): void;
|
|
348
341
|
export declare function _setOutageDiagnosisTtlForTest(ms: number | null): void;
|
|
342
|
+
export declare function _resetRefusalWakeForTest(): void;
|
|
349
343
|
export declare function _setOutageProbeForTest(probe: (() => Promise<"present" | "absent" | "unknown">) | null): void;
|
|
350
344
|
export declare function _diagnoseOutageForTest(): Promise<StatusReason | null>;
|
|
351
345
|
export declare function _invalidateOutageDiagnosisForTest(): void;
|
|
346
|
+
/**
|
|
347
|
+
* Headers that cross from the dashboard server to the device Radar listener.
|
|
348
|
+
*
|
|
349
|
+
* The dashboard terminates the browser-facing HTTP hop, so its Host/Origin,
|
|
350
|
+
* hop-by-hop connection and transfer framing, and X-Radar-Dashboard credentials
|
|
351
|
+
* describe that hop rather than the device request. Forwarding them is especially
|
|
352
|
+
* unsafe for a strict iOS listener reached through a different authority. Preserve
|
|
353
|
+
* only representation negotiation and the body metadata needed to replay writes.
|
|
354
|
+
*/
|
|
355
|
+
export declare function radarProxyHeaders(method: string | undefined, incoming: http.IncomingHttpHeaders, forwarded: boolean): http.OutgoingHttpHeaders;
|
|
352
356
|
export { WEB_PORT };
|