@slack/radar-mcp 1.25.0 → 1.27.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 +47 -3
- package/dist/mcp/api-paths.d.ts +25 -1
- package/dist/mcp/api-paths.js +85 -9
- package/dist/mcp/dispatch.d.ts +1 -0
- package/dist/mcp/dispatch.js +4 -2
- package/dist/mcp/flags-tools.d.ts +1 -0
- package/dist/mcp/flags-tools.js +1 -1
- package/dist/mcp/index.js +36 -11
- package/dist/mcp/json-rows.d.ts +6 -0
- package/dist/mcp/json-rows.js +10 -0
- package/dist/mcp/radar-response.d.ts +2 -2
- package/dist/mcp/radar-response.js +2 -2
- package/dist/mcp/redact.d.ts +14 -0
- package/dist/mcp/redact.js +71 -0
- package/dist/mcp/session-enable.d.ts +1 -0
- package/dist/mcp/session-enable.js +8 -6
- package/dist/mcp/snapshot-cli.d.ts +52 -0
- package/dist/mcp/snapshot-cli.js +331 -0
- package/dist/mcp/snapshot-summary.d.ts +1 -0
- package/dist/mcp/snapshot-summary.js +254 -0
- package/dist/mcp/snapshot.d.ts +32 -3
- package/dist/mcp/snapshot.js +392 -125
- package/dist/mcp/test-runs-tools.d.ts +2 -0
- package/dist/mcp/test-runs-tools.js +58 -5
- package/dist/mcp/tools.js +32 -6
- package/dist/shared/android.d.ts +40 -4
- package/dist/shared/android.js +199 -12
- package/dist/shared/constants.d.ts +6 -5
- package/dist/shared/constants.js +6 -5
- package/dist/shared/feature-flags.d.ts +14 -5
- package/dist/shared/feature-flags.js +23 -6
- package/dist/shared/radar-token.d.ts +5 -5
- package/dist/shared/radar-token.js +24 -10
- package/dist/shared/switchboard-note.js +2 -1
- package/dist/shared/switchboard-report.js +4 -1
- package/dist/shared/test-case-capture.d.ts +15 -0
- package/dist/shared/test-case-capture.js +235 -0
- package/dist/shared/test-case-store.d.ts +54 -0
- package/dist/shared/test-case-store.js +208 -0
- package/dist/shared/transport.d.ts +27 -1
- package/dist/web/install-app.js +1 -1
- package/dist/web/public/index.html +2 -0
- package/dist/web/public/next/app.js +12 -1
- package/dist/web/public/next/feature-flags.js +23 -6
- package/dist/web/public/next/feed.js +19 -4
- package/dist/web/public/next/filters.js +5 -5
- package/dist/web/public/next/flags.js +5 -3
- package/dist/web/public/next/registry.js +3 -2
- package/dist/web/public/next/save-case.js +92 -0
- package/dist/web/public/next/store.js +4 -2
- package/dist/web/public/next/switchboard-note.js +2 -1
- package/dist/web/public/next/test-cases.js +328 -0
- package/dist/web/public/next/voice-model.js +13 -1
- package/dist/web/public/next/voice.js +9 -4
- package/dist/web/server.d.ts +1 -0
- package/dist/web/server.js +214 -2
- package/dist/web/spec.d.ts +3 -2
- package/dist/web/spec.js +10 -9
- package/package.json +1 -1
- package/dist/mcp/test-cases.d.ts +0 -14
- package/dist/mcp/test-cases.js +0 -77
- /package/dist/web/public/icons/{radar-1024.png → icon-1024.png} +0 -0
- /package/dist/web/public/icons/{radar.svg → icon.svg} +0 -0
|
@@ -68,7 +68,8 @@ export const SAVED_TURN_OUTCOMES = [...Object.keys(SAVED_TURN_KEPT), ...SAVED_TU
|
|
|
68
68
|
// A card record in words, shared by the feed row, the voice panel and the report. A kind or event
|
|
69
69
|
// the device adds later shows as sent, and a missing field reads "?", so nothing throws.
|
|
70
70
|
const CARD_KIND_WORDS = { tool_approval: "tool approval", auth_prompt: "connect prompt" };
|
|
71
|
-
// An event in this set takes the card down; "shown" and "carried" put it up.
|
|
71
|
+
// An event in this set takes the card down; "shown" and "carried" put it up. "answer_failed" is in
|
|
72
|
+
// neither: the card stays as it was.
|
|
72
73
|
const CARD_CLOSING_EVENTS = ["answered", "refused", "declined", "closed", "replaced", "expired", "cleared"];
|
|
73
74
|
const CARD_OPENING_EVENTS = ["shown", "carried"];
|
|
74
75
|
export function cardKindWord(kind) {
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
// The Test cases tab: pick a built-in or saved RTM case, replay it on the device and read the timings.
|
|
2
|
+
// Like DB and Prefs it skips the store, so a tab with no live feed runs no stream engine.
|
|
3
|
+
import { html } from "./html.js";
|
|
4
|
+
import { useState, useEffect, useRef } from "preact/hooks";
|
|
5
|
+
const HEADERS = { "X-Radar-Dashboard": "1" };
|
|
6
|
+
const JSON_HEADERS = { ...HEADERS, "Content-Type": "application/json" };
|
|
7
|
+
let pollMs = 1000;
|
|
8
|
+
// The tool's run id rule: an id from the device ends up in a URL path, so anything else is never followed.
|
|
9
|
+
const isRunId = (id) => typeof id === "string" && /^[A-Za-z0-9_-]{1,64}$/.test(id);
|
|
10
|
+
/** Test hook: the progress poll gap, so a test does not wait a real second. */
|
|
11
|
+
export function _setPollMsForTest(ms) {
|
|
12
|
+
pollMs = ms;
|
|
13
|
+
}
|
|
14
|
+
const typeCounts = (types) => Object.entries((types ?? {})).map(([k, n]) => `${k} ${n}`).join(", ");
|
|
15
|
+
const pct = (v) => v == null
|
|
16
|
+
? html `<td title="fewer than 100 counted events (ok plus failed) so far; raise repeat if the run is done">-</td>`
|
|
17
|
+
: html `<td>${String(v)}</td>`;
|
|
18
|
+
function Summary({ run }) {
|
|
19
|
+
const s = run.summary ?? {};
|
|
20
|
+
const settled = run.settled === true;
|
|
21
|
+
const rows = Object.entries((s.by_type ?? {}));
|
|
22
|
+
return html `
|
|
23
|
+
<div class="dbmeta">
|
|
24
|
+
ok ${s.ok ?? 0}, failed ${s.failed ?? 0}, ignored ${s.ignored ?? 0}${settled ? "" : `, pending ${s.pending ?? 0}`}
|
|
25
|
+
${settled ? null : html ` <b>not settled yet, counts can still change</b>`}
|
|
26
|
+
</div>
|
|
27
|
+
<div class="dbout"><table>
|
|
28
|
+
<thead><tr><th>type</th><th>sent</th><th>ok</th><th>failed</th><th>p50 ms</th><th>p90 ms</th><th>p99 ms</th><th>max ms</th></tr></thead>
|
|
29
|
+
<tbody>${rows.map(([type, t]) => html `<tr>
|
|
30
|
+
<td>${type}</td><td>${t.sent}</td><td>${t.ok}</td><td>${t.failed}</td>${pct(t.p50_ms)}${pct(t.p90_ms)}${pct(t.p99_ms)}<td>${t.max_ms ?? "-"}</td>
|
|
31
|
+
</tr>`)}</tbody>
|
|
32
|
+
</table></div>`;
|
|
33
|
+
}
|
|
34
|
+
export function TestCases() {
|
|
35
|
+
const [cases, setCases] = useState(null);
|
|
36
|
+
const [listError, setListError] = useState("");
|
|
37
|
+
const [picked, setPicked] = useState("");
|
|
38
|
+
const [repeat, setRepeat] = useState("");
|
|
39
|
+
const [rate, setRate] = useState("");
|
|
40
|
+
const [runCount, setRunCount] = useState(null);
|
|
41
|
+
const [tracked, setTracked] = useState("");
|
|
42
|
+
const [elsewhere, setElsewhere] = useState(false);
|
|
43
|
+
// The start handler outlives its render, so it reads what is followed from a ref, not from state.
|
|
44
|
+
const trackedRef = useRef("");
|
|
45
|
+
// The last state read for the followed run: a 404 right after "starting" means the device refused the frames.
|
|
46
|
+
const lastStateRef = useRef(null);
|
|
47
|
+
// The run a "may have started" answer named. It is followed as our own, and its note stays until the device answers for it.
|
|
48
|
+
const unconfirmedRef = useRef("");
|
|
49
|
+
// The case the followed run was started with; a run picked up from the device has none.
|
|
50
|
+
const caseRef = useRef(null);
|
|
51
|
+
// A number field holding text the browser cannot read reports "", which would quietly fall back to the case's rate.
|
|
52
|
+
const repeatRef = useRef(null);
|
|
53
|
+
const rateRef = useRef(null);
|
|
54
|
+
const [run, setRun] = useState(null);
|
|
55
|
+
const [note, setNote] = useState("");
|
|
56
|
+
const [pollNote, setPollNote] = useState("");
|
|
57
|
+
const [busy, setBusy] = useState(false);
|
|
58
|
+
const [copied, setCopied] = useState(false);
|
|
59
|
+
// The saved case a Delete click is asking about, and whether its request is out.
|
|
60
|
+
const [confirming, setConfirming] = useState("");
|
|
61
|
+
const [deleting, setDeleting] = useState(false);
|
|
62
|
+
// State lags a second click in the same frame, so the request guard reads a ref.
|
|
63
|
+
const deletingRef = useRef(false);
|
|
64
|
+
const copiedTimer = useRef(undefined);
|
|
65
|
+
// `startedElsewhere` marks a run read from the device, not from our own start answer.
|
|
66
|
+
const track = (id, snapshot = null, startedElsewhere = false, caseName = null) => {
|
|
67
|
+
if (!isRunId(id))
|
|
68
|
+
return;
|
|
69
|
+
trackedRef.current = id;
|
|
70
|
+
caseRef.current = caseName;
|
|
71
|
+
unconfirmedRef.current = "";
|
|
72
|
+
setTracked(id);
|
|
73
|
+
setElsewhere(startedElsewhere);
|
|
74
|
+
setRun(snapshot);
|
|
75
|
+
lastStateRef.current = snapshot?.state ?? null;
|
|
76
|
+
setPollNote("");
|
|
77
|
+
};
|
|
78
|
+
// Reads the device's run list for the counter. Returns the active run id so mount can resume it.
|
|
79
|
+
const loadRuns = async () => {
|
|
80
|
+
try {
|
|
81
|
+
const body = await (await fetch("/api/test_runs", { headers: HEADERS })).json();
|
|
82
|
+
if (Array.isArray(body.runs))
|
|
83
|
+
setRunCount(body.runs.length);
|
|
84
|
+
return isRunId(body.active_run_id) ? body.active_run_id : "";
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return "";
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
// A sequence number drops an older answer that lands after a newer read, e.g. two quick focus events.
|
|
91
|
+
const listSeqRef = useRef(0);
|
|
92
|
+
const deadRef = useRef(false);
|
|
93
|
+
const loadCases = () => {
|
|
94
|
+
const seq = ++listSeqRef.current;
|
|
95
|
+
const stale = () => deadRef.current || seq !== listSeqRef.current;
|
|
96
|
+
return fetch("/test-cases", { headers: HEADERS }).then((r) => r.json()).then((b) => {
|
|
97
|
+
if (stale())
|
|
98
|
+
return;
|
|
99
|
+
if (Array.isArray(b.cases)) {
|
|
100
|
+
setCases(b.cases);
|
|
101
|
+
// A prompt for a case the list no longer shows as deletable is cancelled, so it cannot come back on a later re-read.
|
|
102
|
+
setConfirming((c) => b.cases.some((x) => x.name === c && x.built_in !== true) ? c : "");
|
|
103
|
+
setListError("");
|
|
104
|
+
}
|
|
105
|
+
else
|
|
106
|
+
setListError(String(b.error ?? "could not list test cases"));
|
|
107
|
+
}).catch(() => { if (!stale())
|
|
108
|
+
setListError("could not list test cases"); });
|
|
109
|
+
};
|
|
110
|
+
// An active run (after a reload, or one started from Claude) is followed so Stop still works, unless one is already followed.
|
|
111
|
+
const pickUpActive = () => loadRuns().then((active) => { if (!deadRef.current && active && !trackedRef.current)
|
|
112
|
+
track(active, null, true); });
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
deadRef.current = false;
|
|
115
|
+
void loadCases();
|
|
116
|
+
// A save made in another window or by Claude shows up when the user comes back to this one.
|
|
117
|
+
const onFocus = () => { void loadCases(); void pickUpActive(); };
|
|
118
|
+
window.addEventListener("focus", onFocus);
|
|
119
|
+
void pickUpActive();
|
|
120
|
+
return () => { deadRef.current = true; window.removeEventListener("focus", onFocus); clearTimeout(copiedTimer.current); };
|
|
121
|
+
}, []);
|
|
122
|
+
// One chained timeout per tracked run; a new id or an unmount cancels it, so no fetch outlives the tab.
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
if (!tracked)
|
|
125
|
+
return;
|
|
126
|
+
let dead = false;
|
|
127
|
+
let timer;
|
|
128
|
+
const tick = async () => {
|
|
129
|
+
try {
|
|
130
|
+
const res = await fetch(`/api/test_runs/${encodeURIComponent(tracked)}`, { headers: HEADERS });
|
|
131
|
+
const body = await res.json();
|
|
132
|
+
if (dead)
|
|
133
|
+
return;
|
|
134
|
+
if (res.status === 404) {
|
|
135
|
+
const neverStarted = unconfirmedRef.current === tracked;
|
|
136
|
+
unconfirmedRef.current = "";
|
|
137
|
+
if (neverStarted)
|
|
138
|
+
setNote("");
|
|
139
|
+
setPollNote(neverStarted
|
|
140
|
+
? `run ${tracked} did not start. Press Run again`
|
|
141
|
+
: lastStateRef.current === "starting"
|
|
142
|
+
? `the device refused run ${tracked} while checking its frames; Run it again to see the reason`
|
|
143
|
+
: `the device no longer holds run ${tracked}`);
|
|
144
|
+
// Dropping the run hides Stop, which has nothing left to stop.
|
|
145
|
+
trackedRef.current = "";
|
|
146
|
+
setTracked("");
|
|
147
|
+
setRun(null);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (res.status >= 400) {
|
|
151
|
+
setPollNote(String(body.error ?? `HTTP ${res.status}`));
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
setRun(body);
|
|
155
|
+
lastStateRef.current = body.state ?? null;
|
|
156
|
+
setPollNote("");
|
|
157
|
+
if (unconfirmedRef.current === tracked) {
|
|
158
|
+
unconfirmedRef.current = "";
|
|
159
|
+
setNote("");
|
|
160
|
+
}
|
|
161
|
+
if (body.settled === true) {
|
|
162
|
+
setNote("");
|
|
163
|
+
// Nothing is followed any more, so a later start that times out can pick up the device's active run.
|
|
164
|
+
trackedRef.current = "";
|
|
165
|
+
void loadRuns();
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
if (dead)
|
|
172
|
+
return;
|
|
173
|
+
setPollNote("request failed");
|
|
174
|
+
}
|
|
175
|
+
timer = setTimeout(tick, pollMs);
|
|
176
|
+
};
|
|
177
|
+
void tick();
|
|
178
|
+
return () => { dead = true; clearTimeout(timer); };
|
|
179
|
+
}, [tracked]);
|
|
180
|
+
const start = async () => {
|
|
181
|
+
if (busy || !picked)
|
|
182
|
+
return;
|
|
183
|
+
const unreadable = [[repeatRef, "repeat"], [rateRef, "rate"]].find(([r]) => r.current?.validity?.badInput);
|
|
184
|
+
if (unreadable) {
|
|
185
|
+
setNote(`${unreadable[1]} is not a number`);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
setBusy(true);
|
|
189
|
+
setNote("");
|
|
190
|
+
// Only a filled field goes out; the device answers with its own text when a number is out of range.
|
|
191
|
+
const body = { case: picked };
|
|
192
|
+
const num = (v) => (v.trim() !== "" && Number.isFinite(Number(v)) ? Number(v) : null);
|
|
193
|
+
if (num(repeat) !== null)
|
|
194
|
+
body.repeat = num(repeat);
|
|
195
|
+
if (num(rate) !== null)
|
|
196
|
+
body.rate_per_second = num(rate);
|
|
197
|
+
try {
|
|
198
|
+
const res = await fetch("/test-cases/run", { method: "POST", headers: JSON_HEADERS, body: JSON.stringify(body) });
|
|
199
|
+
const answer = await res.json();
|
|
200
|
+
// The route answers 400 for a refused request; a 200 can still carry a failed run's own error, which is run data.
|
|
201
|
+
if (res.status >= 400) {
|
|
202
|
+
setNote(String(answer.error ?? `HTTP ${res.status}`));
|
|
203
|
+
if (answer.reason === "may_have_started" && isRunId(answer.run_id)) {
|
|
204
|
+
track(answer.run_id, null, false, picked);
|
|
205
|
+
unconfirmedRef.current = answer.run_id;
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
// Any other refusal carries the id of a run that never started, so only the active one is tracked.
|
|
209
|
+
track(answer.active_run_id, null, true);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
track(answer.run_id, answer, false, picked);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
setNote("request failed");
|
|
218
|
+
}
|
|
219
|
+
finally {
|
|
220
|
+
setBusy(false);
|
|
221
|
+
// A start that timed out can still have begun; the device's active run is followed if nothing else is.
|
|
222
|
+
void pickUpActive();
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
const stop = async () => {
|
|
226
|
+
try {
|
|
227
|
+
const res = await fetch(`/api/test_runs/${encodeURIComponent(tracked)}`, { method: "DELETE", headers: HEADERS });
|
|
228
|
+
const answer = await res.json();
|
|
229
|
+
if (res.status >= 400)
|
|
230
|
+
setNote(String(answer.error ?? `HTTP ${res.status}`));
|
|
231
|
+
else
|
|
232
|
+
setRun(answer);
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
setNote("request failed");
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
// The whole settled snapshot, with the case it ran, since two pasted summaries are hard to tell apart without it.
|
|
239
|
+
const copySummary = async () => {
|
|
240
|
+
setNote("");
|
|
241
|
+
try {
|
|
242
|
+
await navigator.clipboard.writeText(JSON.stringify({ case: caseRef.current, run }, null, 2));
|
|
243
|
+
setCopied(true);
|
|
244
|
+
clearTimeout(copiedTimer.current);
|
|
245
|
+
copiedTimer.current = setTimeout(() => setCopied(false), 1200);
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
setNote("could not copy the summary");
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
// Asks first in the page, because the file is gone for good; the dock's web view has no confirm dialog.
|
|
252
|
+
// A run being followed keeps going; the case file is not part of it.
|
|
253
|
+
const remove = async () => {
|
|
254
|
+
const name = confirming;
|
|
255
|
+
if (!name || deletingRef.current)
|
|
256
|
+
return;
|
|
257
|
+
deletingRef.current = true;
|
|
258
|
+
setDeleting(true);
|
|
259
|
+
setNote("");
|
|
260
|
+
try {
|
|
261
|
+
const res = await fetch(`/test-cases?name=${encodeURIComponent(name)}`, { method: "DELETE", headers: HEADERS });
|
|
262
|
+
// The status decides; a good answer with an odd body still deleted the file.
|
|
263
|
+
const answer = ((await res.json().catch(() => null)) ?? {});
|
|
264
|
+
if (res.status >= 400)
|
|
265
|
+
setNote(String(answer.error ?? `HTTP ${res.status}`));
|
|
266
|
+
else
|
|
267
|
+
setPicked((p) => (p === name ? "" : p));
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
setNote("request failed");
|
|
271
|
+
}
|
|
272
|
+
finally {
|
|
273
|
+
setConfirming("");
|
|
274
|
+
deletingRef.current = false;
|
|
275
|
+
setDeleting(false);
|
|
276
|
+
}
|
|
277
|
+
void loadCases();
|
|
278
|
+
};
|
|
279
|
+
// An error row is pickable so a broken file can be deleted.
|
|
280
|
+
const item = (c) => html `<div
|
|
281
|
+
class=${"dbitem" + (c.name === picked ? " sel" : "") + (c.error ? " bad" : "")}
|
|
282
|
+
title=${c.error ? String(c.error) : undefined}
|
|
283
|
+
onClick=${() => { setPicked(c.name); setConfirming(""); }}
|
|
284
|
+
>${c.name}${c.error ? " (cannot load)" : ""}</div>`;
|
|
285
|
+
const current = cases?.find((c) => c.name === picked);
|
|
286
|
+
const active = tracked !== "" && run?.settled !== true;
|
|
287
|
+
// Delete and its prompt share this, so a re-read that turns the row back into its built-in drops both.
|
|
288
|
+
const deletable = current !== undefined && current.built_in !== true;
|
|
289
|
+
return html `
|
|
290
|
+
<div class="dbview">
|
|
291
|
+
<div class="dbside">
|
|
292
|
+
<div class="dbsec">built in</div>
|
|
293
|
+
${cases == null ? html `<div class="msg ${listError ? "err" : ""}">${listError || "loading…"}</div>` : cases.filter((c) => c.built_in === true).map(item)}
|
|
294
|
+
${cases != null && listError ? html `<div class="msg err">${listError}; the list may be out of date</div>` : null}
|
|
295
|
+
${cases?.some((c) => c.built_in !== true) ? html `<div class="dbsec">saved</div>${cases.filter((c) => c.built_in !== true).map(item)}` : null}
|
|
296
|
+
</div>
|
|
297
|
+
<div class="dbmain">
|
|
298
|
+
<div class="dbmeta">${current?.error
|
|
299
|
+
? `cannot load: ${current.error}`
|
|
300
|
+
: current
|
|
301
|
+
? `${current.events} events (${typeCounts(current.types)}), default repeat ${current.repeat}, rate ${current.rate_per_second ?? "burst"}`
|
|
302
|
+
: "pick a case"}</div>
|
|
303
|
+
${confirming && confirming === picked && deletable ? html `<div class="dbmeta" role="alert">
|
|
304
|
+
Delete the saved case ${confirming}? This removes its file${current?.replaces_built_in ? `, and the built-in ${confirming} comes back` : ""}.
|
|
305
|
+
<button type="button" disabled=${deleting} onClick=${remove}>Yes, delete</button>
|
|
306
|
+
<button type="button" disabled=${deleting} onClick=${() => setConfirming("")}>Cancel</button>
|
|
307
|
+
</div>` : null}
|
|
308
|
+
<div class="dbqbar">
|
|
309
|
+
<input type="number" aria-label="repeat" ref=${repeatRef} placeholder=${current && !current.error ? `repeat ${current.repeat}` : "repeat"} value=${repeat}
|
|
310
|
+
onInput=${(e) => setRepeat(e.currentTarget.value)} />
|
|
311
|
+
<input type="number" aria-label="rate per second" ref=${rateRef} placeholder=${current && !current.error ? `rate/s ${current.rate_per_second ?? "burst"}` : "rate/s"} value=${rate}
|
|
312
|
+
onInput=${(e) => setRate(e.currentTarget.value)} />
|
|
313
|
+
<button type="button" disabled=${!current || current.error || busy} onClick=${start}>Run</button>
|
|
314
|
+
${deletable && confirming !== picked ? html `<button type="button" onClick=${() => setConfirming(picked)}>Delete</button>` : null}
|
|
315
|
+
${active ? html `<button type="button" onClick=${stop}>Stop</button>` : null}
|
|
316
|
+
${run?.settled === true ? html `<button type="button" onClick=${copySummary}>${copied ? "copied" : "Copy summary"}</button>` : null}
|
|
317
|
+
</div>
|
|
318
|
+
${note ? html `<div class="msg err" role="status">${note}</div>` : null}
|
|
319
|
+
<div class="dbmeta">${runCount == null ? "" : `runs on the device: ${runCount}`}</div>
|
|
320
|
+
${run ? html `
|
|
321
|
+
<div class="dbmeta">
|
|
322
|
+
run ${tracked}${elsewhere ? " (picked up from the device)" : ""}: ${run.state}, ${run.sent} of ${run.frames} sent${typeof run.achieved_rate === "number" ? `, ${run.achieved_rate.toFixed(1)}/s` : ""}${run.stop_reason ? `, stopped: ${run.stop_reason}` : ""}${run.summary?.failed_label ? `, failed: ${run.summary.failed_label}` : ""}
|
|
323
|
+
</div>
|
|
324
|
+
<${Summary} run=${run} />` : null}
|
|
325
|
+
${pollNote ? html `<div class="msg err">${pollNote}</div>` : null}
|
|
326
|
+
</div>
|
|
327
|
+
</div>`;
|
|
328
|
+
}
|
|
@@ -294,6 +294,10 @@ export function markers(rows, window) {
|
|
|
294
294
|
const cause = str(r.cause);
|
|
295
295
|
out.push({ kind: "focus", t, label: cause ? `mic Paused (${cause})` : "mic Paused", record: r });
|
|
296
296
|
}
|
|
297
|
+
else if (r.kind === "state" && r.state_kind === "connection" && r.to === "Disconnected" && r.cause === "SwipedAway") {
|
|
298
|
+
// The user's own swipe, so the neutral kind the server-ended tick uses, not an error.
|
|
299
|
+
out.push({ kind: "ending", t, label: "app swiped away", record: r });
|
|
300
|
+
}
|
|
297
301
|
else if (r.kind === "state" && r.state_kind === "connection" && r.to === "Failed") {
|
|
298
302
|
const cause = str(r.cause);
|
|
299
303
|
// A server ending that is a normal end (a limit, the model's goodbye) is not a fault, so it
|
|
@@ -667,6 +671,7 @@ export function windowStats(rows, from, to) {
|
|
|
667
671
|
let jitterTrim = 0;
|
|
668
672
|
let holdRefuse = 0;
|
|
669
673
|
let preReadyDrop = 0;
|
|
674
|
+
let preReadyChunks = null;
|
|
670
675
|
let framesIn = 0;
|
|
671
676
|
let framesOut = 0;
|
|
672
677
|
for (let i = rows.length - 1; i >= 0; i--) {
|
|
@@ -691,8 +696,12 @@ export function windowStats(rows, from, to) {
|
|
|
691
696
|
jitterTrim++;
|
|
692
697
|
else if (r.event === "hold_refuse")
|
|
693
698
|
holdRefuse++;
|
|
694
|
-
else if (r.event === "pre_ready_drop")
|
|
699
|
+
else if (r.event === "pre_ready_drop") {
|
|
695
700
|
preReadyDrop++;
|
|
701
|
+
const c = num(r.dropped_chunks);
|
|
702
|
+
if (c !== null)
|
|
703
|
+
preReadyChunks = (preReadyChunks ?? 0) + c;
|
|
704
|
+
}
|
|
696
705
|
}
|
|
697
706
|
else if (r.kind === "frame") {
|
|
698
707
|
if (r.direction === "incoming")
|
|
@@ -711,6 +720,7 @@ export function windowStats(rows, from, to) {
|
|
|
711
720
|
jitterTrim,
|
|
712
721
|
holdRefuse,
|
|
713
722
|
preReadyDrop,
|
|
723
|
+
preReadyChunks,
|
|
714
724
|
framesIn,
|
|
715
725
|
framesOut,
|
|
716
726
|
};
|
|
@@ -872,6 +882,8 @@ export function buildVoiceModel(rows, zoom, now, summaryServerSessionId, summary
|
|
|
872
882
|
model: segments(modelRows, "speaking", "speaking", closeAt).filter(inWindow),
|
|
873
883
|
you: segments(modelRows, "mic", "Capturing", closeAt).filter(inWindow),
|
|
874
884
|
youMuted: segments(modelRows, "mic", "Muted", closeAt).filter(inWindow),
|
|
885
|
+
youSpeaking: segments(modelRows, "user_speaking", "speaking", closeAt).filter(inWindow),
|
|
886
|
+
hasUserSpeaking: modelRows.some((r) => r.kind === "state" && r.state_kind === "user_speaking"),
|
|
875
887
|
micEncoding: summaryMicEncoding ?? null,
|
|
876
888
|
replyHolds: replyHolds(modelRows, closeAt).filter(inWindow),
|
|
877
889
|
markers: markers(modelRows, { from: window.from, to: window.to, ended: endedAt !== null }),
|
|
@@ -281,7 +281,7 @@ function SessionStrip({ m }) {
|
|
|
281
281
|
<div class="voice-card">
|
|
282
282
|
<div class="voice-hd">Session</div>
|
|
283
283
|
<div class="voice-strip">
|
|
284
|
-
<span class="voice-pill" title=${m.endedNormally ? "the server ended the call normally (a limit or the model's goodbye)" : undefined}><i class=${"voice-dot " + (conn ? dotClass(conn.to, m.endedNormally) : "")} aria-hidden="true"></i>${connText}${conn && (conn.to === "Failed" || conn.to === "Reconnecting") && conn.cause ? html ` <span class="voice-note">(${conn.cause})</span>` : null}</span>
|
|
284
|
+
<span class="voice-pill" title=${m.endedNormally ? "the server ended the call normally (a limit or the model's goodbye)" : undefined}><i class=${"voice-dot " + (conn ? dotClass(conn.to, m.endedNormally) : "")} aria-hidden="true"></i>${connText}${conn && (conn.to === "Failed" || conn.to === "Reconnecting" || conn.to === "Disconnected") && conn.cause ? html ` <span class="voice-note">(${conn.cause})</span>` : null}</span>
|
|
285
285
|
${m.ended ? html `<span class="voice-note voice-ended">ended</span>` : null}
|
|
286
286
|
<span class="voice-kv">session <b>${String(m.sessionId)}</b></span>
|
|
287
287
|
<span class="voice-pill"><i class=${"voice-dot " + micClass(m.mic?.to)} aria-hidden="true"></i>mic ${m.mic ? m.mic.to : "unknown"}</span>
|
|
@@ -446,9 +446,12 @@ function Tracks({ m, title, rearms, onPick }) {
|
|
|
446
446
|
}
|
|
447
447
|
const seg = (s, row, y, fill, opacity) => html `<rect class=${"voice-seg voice-seg-" + row} x=${x(s.from)} y=${y} width=${Math.max(2, x(s.to) - x(s.from))} height=${ROW_H} rx="3" fill=${fill} opacity=${opacity} />`;
|
|
448
448
|
const segMuted = (s) => html `<rect class="voice-seg voice-seg-muted" x=${x(s.from)} y=${ROW_Y.you} width=${Math.max(2, x(s.to) - x(s.from))} height=${ROW_H} rx="3" fill="url(#voice-hatch)" opacity=".9" stroke="var(--purple)" stroke-width="1.5" vector-effect="non-scaling-stroke" />`;
|
|
449
|
+
// A thin band along the bottom of the you row, so it reads on top of capturing and muted spans.
|
|
450
|
+
const segSpeaking = (s) => html `<rect class="voice-seg voice-seg-speaking" x=${x(s.from)} y=${ROW_Y.you + ROW_H - 4} width=${Math.max(2, x(s.to) - x(s.from))} height="4" fill="var(--warn-2)" opacity=".9" />`;
|
|
449
451
|
const model = mergeSegmentsByColumn(m.model, x);
|
|
450
452
|
const you = mergeSegmentsByColumn(m.you, x);
|
|
451
453
|
const youMuted = mergeSegmentsByColumn(m.youMuted, x);
|
|
454
|
+
const youSpeaking = mergeSegmentsByColumn(m.youSpeaking, x);
|
|
452
455
|
const holds = mergeSegmentsByColumn(m.replyHolds, x);
|
|
453
456
|
// Spans the playback rows only: the model row, plus the playback level row when levels are drawn.
|
|
454
457
|
const holdBand = (s, y, h) => html `<rect class="voice-seg voice-seg-hold" x=${x(s.from)} y=${y} width=${Math.max(2, x(s.to) - x(s.from))} height=${h} fill="var(--muted-2)" opacity=".25"><title>${HOLD_TITLE}</title></rect>`;
|
|
@@ -502,6 +505,7 @@ function Tracks({ m, title, rearms, onPick }) {
|
|
|
502
505
|
${model.map((s) => seg(s, "model", ROW_Y.model, "var(--blue)", ".45"))}
|
|
503
506
|
${you.map((s) => seg(s, "you", ROW_Y.you, "var(--accent)", ".4"))}
|
|
504
507
|
${youMuted.map(segMuted)}
|
|
508
|
+
${youSpeaking.map(segSpeaking)}
|
|
505
509
|
${holds.map((s) => holdBand(s, ROW_Y.model, ROW_H))}
|
|
506
510
|
${m.hasLevels ? holds.map((s) => holdBand(s, ROW_Y.playbackLevel, LEVEL_ROW_H)) : null}
|
|
507
511
|
${drawn.map((k) => {
|
|
@@ -560,12 +564,13 @@ function Tracks({ m, title, rearms, onPick }) {
|
|
|
560
564
|
<span class="m">model speaking</span>
|
|
561
565
|
<span class="y">you capturing</span>
|
|
562
566
|
<span class="mu">you (muted)</span>
|
|
567
|
+
${m.hasUserSpeaking ? html `<span class="ys">likely speaking</span>` : null}
|
|
563
568
|
${holds.length > 0 ? html `<span class="hd" title=${HOLD_TITLE}>reply on hold (you paused it)</span>` : null}
|
|
564
569
|
<span class="r">playback re-arm</span>
|
|
565
570
|
<span class="s">tts.stop sent</span>
|
|
566
571
|
<span class="st">player stall</span>
|
|
567
572
|
<span class="e">connection failed</span>
|
|
568
|
-
<span class="en">
|
|
573
|
+
<span class="en">call ended (server or swipe)</span>
|
|
569
574
|
<span class="f">mic paused</span>
|
|
570
575
|
${hasCard ? html `<span class="cd">card</span>` : null}
|
|
571
576
|
${hasClipping ? html `<span class="clip">clipping</span>` : null}
|
|
@@ -584,7 +589,7 @@ function cardsTitle(m) {
|
|
|
584
589
|
: "";
|
|
585
590
|
if (open.length === 0)
|
|
586
591
|
return m.cardsPartial ? partial.trim() : "no card is waiting";
|
|
587
|
-
return `${partial}shown or carried
|
|
592
|
+
return `${partial}shown or carried and not taken down since: ${open.map((c) => `${cardKindWord(c.kind)} ${c.id}`).join("; ")}`;
|
|
588
593
|
}
|
|
589
594
|
function StatCards({ m }) {
|
|
590
595
|
const s = m.stats;
|
|
@@ -603,7 +608,7 @@ function StatCards({ m }) {
|
|
|
603
608
|
<div class="l">playback re-arms</div>
|
|
604
609
|
</div>
|
|
605
610
|
<div class=${"voice-stat" + gapClass} title=${`p95 over ${GAP_P95_BAD_MS} ms reads as choppy`}><div class="v">${gapText}</div><div class="l">gap at re-arm p50 / p95 (bad > ${GAP_P95_BAD_MS} ms)</div></div>
|
|
606
|
-
<div class=${"voice-stat" + (s.holdRefuse > 0 || s.preReadyDrop > 0 ? " warn" : "")} title
|
|
611
|
+
<div class=${"voice-stat" + (s.holdRefuse > 0 || s.preReadyDrop > 0 ? " warn" : "")} title=${`jitter trim = the player skipped buffered audio to catch up, expected in small numbers; hold refuse = a held reply's queue was full, so the newest audio was dropped; pre-ready = mic audio held before session.ready was dropped${s.preReadyChunks !== null ? ` (${s.preReadyChunks} chunk${s.preReadyChunks === 1 ? "" : "s"})` : ""}, check the handshake`}><div class="v">${s.jitterTrim} / ${s.holdRefuse} / ${s.preReadyDrop}</div><div class="l">drops: jitter trim / hold refuse / pre-ready</div></div>
|
|
607
612
|
<div class="voice-stat" title="includes control frames; the uplink and downlink pills count audio frames only when the device tags them"><div class="v">${s.framesIn} / ${s.framesOut}</div><div class="l">frames in / out this window (all types)</div></div>
|
|
608
613
|
</div>
|
|
609
614
|
`;
|
package/dist/web/server.d.ts
CHANGED
|
@@ -344,6 +344,7 @@ export declare function fetchSwitchboardBackfill(limit: number, deadlineMs: numb
|
|
|
344
344
|
event: Record<string, unknown>;
|
|
345
345
|
}[]>;
|
|
346
346
|
export declare const _switchboardExportGetForTest: SwitchboardExportGet;
|
|
347
|
+
export declare function _setSaveCaseTotalMsForTest(ms: number): void;
|
|
347
348
|
export declare function _setSwitchboardExportStaleMsForTest(ms: number): void;
|
|
348
349
|
/**
|
|
349
350
|
* Finish a /detail proxy response after an upstream error or timeout. The success
|