@slack/radar-mcp 1.24.0 → 1.25.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.
@@ -8,7 +8,7 @@ import { useMemo, useRef, useState } from "preact/hooks";
8
8
  import { useStorePulse } from "./hooks.js";
9
9
  import { store } from "./store.js";
10
10
  import { showToast } from "./toast.js";
11
- import { capitalizeSwitchboardNote, SAVED_TURN_KEPT_OUTCOMES, savedTurnCountWord } from "./switchboard-note.js";
11
+ import { capitalizeSwitchboardNote, cardKindWord, micEncodingNote, reconnectOutcomeWord, reconnectTriggerWord, SAVED_TURN_KEPT_OUTCOMES, savedTurnCountWord } from "./switchboard-note.js";
12
12
  import { buildVoiceModel, CLIP_PEAK, dbfsHeight, GAP_P95_BAD_MS, phaseLabel, RATE_MIN_DIVISOR_MS, tickStepMs, ZOOMS } from "./voice-model.js";
13
13
  // The stream view draws the panel only on the Switchboard tab and only while the spec keeps the
14
14
  // voice key, so a custom spec on that source can leave it out.
@@ -39,10 +39,14 @@ const MARKER_COLOUR = {
39
39
  stop: "var(--purple)",
40
40
  focus: "var(--muted-2)",
41
41
  error: "var(--error)",
42
+ // Neutral on purpose: --muted-2 is focus, and a normal ending is not a fault.
43
+ ending: "var(--muted)",
42
44
  // --warn-2 exists in both themes (unlike --warn-text, which is light-only), so the stall gets
43
45
  // its own shade rather than reusing --warn; the dashed stroke below keeps it further apart from
44
46
  // a re-arm still.
45
47
  stall: "var(--warn-2)",
48
+ // A shade of blue none of the other markers use, so a card tick is not read as a fault.
49
+ card: "var(--blue-2)",
46
50
  // Distinct from `focus`'s var(--muted-2): a collapsed group of mixed-kind markers is its own
47
51
  // thing, not another shade of the same "quiet" colour.
48
52
  mixed: "var(--text)",
@@ -63,11 +67,35 @@ function phaseInlineText(p) {
63
67
  return html `${phaseLabel(p.name)}`;
64
68
  return p.timedOut ? html `${phaseLabel(p.name)} timed out after ${(p.ms / 1000).toFixed(1)} s` : html `${phaseLabel(p.name)} <b>${p.ms}</b>`;
65
69
  }
66
- function dotClass(state) {
70
+ function reconnectText(rc, ended, beginAt) {
71
+ if (rc.overflow)
72
+ return html `+${rc.n} earlier${rc.tries ? (rc.n === 1 ? " try" : " tries") : ""}`;
73
+ const label = rc.unnumbered ? "reconnect" : `reconnect #${rc.n}`;
74
+ const at = beginAt !== null ? ` · at ${((rc.at - beginAt) / 1000).toFixed(1)} s` : "";
75
+ const socket = rc.socketMs !== null ? html ` · socket <b>${rc.socketMs}</b>` : null;
76
+ const readyPart = rc.readyMs !== null ? html ` · session.ready <b>${rc.readyMs}</b>` : null;
77
+ if (rc.outcome !== undefined) {
78
+ // The model always sets trigger next to outcome.
79
+ const trigger = rc.trigger;
80
+ const after = `after a ${reconnectTriggerWord(trigger)}`;
81
+ if (rc.outcome === "gave_up") {
82
+ return html `${label} · ${after} · gave up after ${rc.tryN ?? "?"} ${rc.tryN === 1 ? "try" : "tries"}${at}`;
83
+ }
84
+ return html `${label} · ${after} · try ${rc.tryN ?? "?"}${socket}${readyPart} · ${reconnectOutcomeWord(rc.outcome)}${at}`;
85
+ }
86
+ const ready = readyPart ??
87
+ (rc.abandoned
88
+ ? " · no session.ready, the next try replaced it"
89
+ : ended
90
+ ? " · session.ready never came"
91
+ : " · waiting on session.ready");
92
+ return html `${label}${socket}${ready}${at}`;
93
+ }
94
+ function dotClass(state, endedNormally = false) {
67
95
  if (state === "Connected")
68
96
  return "ok";
69
97
  if (state === "Failed")
70
- return "bad";
98
+ return endedNormally ? "" : "bad";
71
99
  // Disconnected is a settled, unremarkable state (the session ended, or never got going yet
72
100
  // some other way): a warn dot there reads as an ongoing problem it is not. Connecting and
73
101
  // Reconnecting keep the warn colour, still mid-transition.
@@ -169,16 +197,18 @@ export function VoicePanel({ onInspect, now = () => Date.now() }) {
169
197
  const rows = store.switchboardRunRows();
170
198
  const sid = store.switchboardNewestSessionId();
171
199
  const summaryServerSessionId = sid !== null ? store.switchboardSummaryServerId(sid) : undefined;
200
+ const summaryServerSessionIds = sid !== null ? store.switchboardSummaryServerIds(sid) : undefined;
201
+ const summaryMicEncoding = sid !== null ? store.switchboardSummaryMicEncoding(sid) : undefined;
172
202
  const summarySavedTurnCounts = sid !== null ? store.switchboardSummarySavedTurnCounts(sid) : undefined;
173
203
  // Mutated in place as saved_turn rows land; each new one of the drawn run also lands in `rows`,
174
204
  // which rebuilds the model.
175
205
  const savedTurnOutcomes = sid !== null ? store.switchboardSavedTurnOutcomes(sid) : undefined;
176
206
  const clockKey = ended.current ? 0 : Math.floor(now() / 1000);
177
207
  const m = useMemo(() => {
178
- const model = buildVoiceModel(rows, zoom, now(), summaryServerSessionId, summarySavedTurnCounts, savedTurnOutcomes);
208
+ const model = buildVoiceModel(rows, zoom, now(), summaryServerSessionId, summarySavedTurnCounts, savedTurnOutcomes, summaryServerSessionIds, summaryMicEncoding);
179
209
  ended.current = model !== null && model.ended;
180
210
  return model;
181
- }, [rows, zoom, summaryServerSessionId, summarySavedTurnCounts, savedTurnOutcomes, clockKey]);
211
+ }, [rows, zoom, summaryServerSessionId, summaryServerSessionIds, summaryMicEncoding, summarySavedTurnCounts, savedTurnOutcomes, clockKey]);
182
212
  // Records exist but none names a session, or there is no switchboard record at all: draw
183
213
  // nothing. The feed's own empty state already tells the person what to do next.
184
214
  if (!m)
@@ -240,23 +270,25 @@ function SessionStrip({ m }) {
240
270
  // never there to begin with), not the "nothing has happened yet" case a brand-new session reads
241
271
  // as, so it gets its own wording rather than reusing "no session yet".
242
272
  const connText = conn ? conn.to : m.ended ? "connection unknown" : "no session yet";
273
+ // After a normal server ending the goodbye is still playing out, so a quiet downlink is expected.
243
274
  // A downlink pill reading 0/s while the model is speaking is not a problem in a session too
244
275
  // young to have cleared the rate's own minimum divisor yet -- that is exactly what sessionAgeMs
245
276
  // guards against. No begin record at all means the age itself is unknown, so it reads the same
246
277
  // as "too young" rather than assuming the worst. Past that age, 0 audio frames arriving while
247
278
  // the model is supposedly speaking is the downlink itself running dry, not a startup artifact.
248
- const downlinkWarn = m.speaking?.to === "speaking" && m.sessionAgeMs !== null && m.sessionAgeMs > RATE_MIN_DIVISOR_MS && m.downlink.perSec === 0;
279
+ const downlinkWarn = !m.endedNormally && m.speaking?.to === "speaking" && m.sessionAgeMs !== null && m.sessionAgeMs > RATE_MIN_DIVISOR_MS && m.downlink.perSec === 0;
249
280
  return html `
250
281
  <div class="voice-card">
251
282
  <div class="voice-hd">Session</div>
252
283
  <div class="voice-strip">
253
- <span class="voice-pill"><i class=${"voice-dot " + (conn ? dotClass(conn.to) : "")} aria-hidden="true"></i>${connText}${conn && conn.to === "Failed" && 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.cause ? html ` <span class="voice-note">(${conn.cause})</span>` : null}</span>
254
285
  ${m.ended ? html `<span class="voice-note voice-ended">ended</span>` : null}
255
286
  <span class="voice-kv">session <b>${String(m.sessionId)}</b></span>
256
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>
288
+ ${m.micEncoding ? html `<span class="voice-kv" title=${micEncodingNote(m.micEncoding) ?? undefined}>codec <b>${m.micEncoding}</b></span>` : null}
257
289
  <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
290
  ${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>`
291
+ ? html `<button type="button" class="voice-pill voice-pill-server" title=${m.serverSession.all.length > 1 ? `server session ids: ${m.serverSession.all.join(", ")}. Click copies the newest.` : "server session id, click to copy"} onClick=${() => copyServerSessionId(m.serverSession.id)}>server <b>${m.serverSession.id}</b>${m.serverSession.all.length > 1 ? ` +${m.serverSession.all.length - 1}` : ""}</button>`
260
292
  : m.serverSession.pending
261
293
  ? html `<span class="voice-pill voice-pill-server voice-note" title="waiting on the device's session.ready record">server id pending</span>`
262
294
  : m.savedTurns?.some((c) => c.outcome === "other_session" && c.count > 0)
@@ -267,7 +299,10 @@ function SessionStrip({ m }) {
267
299
  ${m.savedTurns
268
300
  ? 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
301
  : null}
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>
302
+ ${m.openCards
303
+ ? html `<span class="voice-kv" title=${cardsTitle(m)}>cards up <b>${m.openCards.length}</b>${m.cardsPartial ? " seen" : ""}${m.ended ? " at close" : ""}</span>`
304
+ : null}
305
+ <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${m.micEncoding && micEncodingNote(m.micEncoding) ? `; mic codec ${m.micEncoding}: ${micEncodingNote(m.micEncoding)}` : ""}`}>uplink <b>${m.uplink.perSec.toFixed(1)}/s</b> ${m.uplink.rule === "audio" ? "audio frames" : "frames"}${m.ended ? " at close" : ""}</span>
271
306
  <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>
272
307
  </div>
273
308
  ${m.phases.length
@@ -294,6 +329,9 @@ function SessionStrip({ m }) {
294
329
  </div>
295
330
  `
296
331
  : html `<div class="voice-note">no phase records yet</div>`}
332
+ ${
333
+ // Outside the phases block: a long call can hold reconnect rows after the startup rows aged out.
334
+ m.reconnects.map((rc) => html `<div class="voice-note voice-reconnect">${reconnectText(rc, m.ended, m.beginAt)}</div>`)}
297
335
  </div>
298
336
  `;
299
337
  }
@@ -385,6 +423,7 @@ function levelBars(points, y, h, x, colour, rowClass) {
385
423
  </g>`;
386
424
  });
387
425
  }
426
+ const HOLD_TITLE = "reply on hold: audio kept arriving and queued, the mic stayed open with the uplink muted; silence here is the pause, not loss";
388
427
  function Tracks({ m, title, rearms, onPick }) {
389
428
  const H = plotHeight(m.hasLevels);
390
429
  const { from, to } = m.window;
@@ -410,8 +449,12 @@ function Tracks({ m, title, rearms, onPick }) {
410
449
  const model = mergeSegmentsByColumn(m.model, x);
411
450
  const you = mergeSegmentsByColumn(m.you, x);
412
451
  const youMuted = mergeSegmentsByColumn(m.youMuted, x);
452
+ const holds = mergeSegmentsByColumn(m.replyHolds, x);
453
+ // Spans the playback rows only: the model row, plus the playback level row when levels are drawn.
454
+ 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>`;
413
455
  const drawn = collapseMarkers(m.markers, x);
414
456
  const hasMixed = drawn.some((k) => k.kind === "mixed");
457
+ const hasCard = drawn.some((k) => k.kind === "card");
415
458
  // A burst reads differently from a plain mixed collapse: still one kind throughout, just more
416
459
  // than one record of it landed in the same spot (see DrawMarker.multi).
417
460
  const hasBurst = drawn.some((k) => k.multi && k.kind !== "mixed");
@@ -459,6 +502,8 @@ function Tracks({ m, title, rearms, onPick }) {
459
502
  ${model.map((s) => seg(s, "model", ROW_Y.model, "var(--blue)", ".45"))}
460
503
  ${you.map((s) => seg(s, "you", ROW_Y.you, "var(--accent)", ".4"))}
461
504
  ${youMuted.map(segMuted)}
505
+ ${holds.map((s) => holdBand(s, ROW_Y.model, ROW_H))}
506
+ ${m.hasLevels ? holds.map((s) => holdBand(s, ROW_Y.playbackLevel, LEVEL_ROW_H)) : null}
462
507
  ${drawn.map((k) => {
463
508
  const c = MARKER_COLOUR[k.kind];
464
509
  // The stroke width is the burst cue: same-kind bursts read 8, wider than a plain
@@ -515,11 +560,14 @@ function Tracks({ m, title, rearms, onPick }) {
515
560
  <span class="m">model speaking</span>
516
561
  <span class="y">you capturing</span>
517
562
  <span class="mu">you (muted)</span>
563
+ ${holds.length > 0 ? html `<span class="hd" title=${HOLD_TITLE}>reply on hold (you paused it)</span>` : null}
518
564
  <span class="r">playback re-arm</span>
519
565
  <span class="s">tts.stop sent</span>
520
566
  <span class="st">player stall</span>
521
567
  <span class="e">connection failed</span>
568
+ <span class="en">server ended the call</span>
522
569
  <span class="f">mic paused</span>
570
+ ${hasCard ? html `<span class="cd">card</span>` : null}
523
571
  ${hasClipping ? html `<span class="clip">clipping</span>` : null}
524
572
  ${hasMixed ? html `<span class="mx">multiple markers</span>` : null}
525
573
  ${hasBurst ? html `<span class="mb">burst (several at one spot, hover for the count)</span>` : null}
@@ -528,6 +576,16 @@ function Tracks({ m, title, rearms, onPick }) {
528
576
  </div>
529
577
  `;
530
578
  }
579
+ // Partial rows cannot say no card is waiting, so the title owns up to what the tab holds.
580
+ function cardsTitle(m) {
581
+ const open = m.openCards ?? [];
582
+ const partial = m.cardsPartial
583
+ ? "this tab holds only the newest records of this call, so a card shown before them is not counted; export the session for every record. "
584
+ : "";
585
+ if (open.length === 0)
586
+ return m.cardsPartial ? partial.trim() : "no card is waiting";
587
+ return `${partial}shown or carried with no later record: ${open.map((c) => `${cardKindWord(c.kind)} ${c.id}`).join("; ")}`;
588
+ }
531
589
  function StatCards({ m }) {
532
590
  const s = m.stats;
533
591
  // gapSamples, not p50/p95 > 0: a re-arm with no usable gap_ms (see markers()'s own "unusable
@@ -545,7 +603,7 @@ function StatCards({ m }) {
545
603
  <div class="l">playback re-arms</div>
546
604
  </div>
547
605
  <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>
548
- <div class=${"voice-stat" + (s.preReadyDrop > 0 ? " warn" : "")} title="jitter trim = the player skipped buffered audio to catch up, expected in small numbers; pre-ready = audio landed before session.ready, check the handshake"><div class="v">${s.jitterTrim} / ${s.preReadyDrop}</div><div class="l">drops: jitter trim / pre-ready</div></div>
606
+ <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 = audio landed before session.ready, 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>
549
607
  <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>
550
608
  </div>
551
609
  `;
@@ -14,7 +14,7 @@
14
14
  * Sources the dashboard can read. The first five plus "switchboard" are live streams; "all" is
15
15
  * their unified timeline. "db", "prefs", and "flags" are read-only point-in-time browsers (not
16
16
  * streams) and are each handled as a distinct view. "switchboard" is the Slackbot voice transport's
17
- * own event stream (session / state / frame / phase / player / levels / turn / saved_turn records),
17
+ * own event stream (session / state / frame / phase / player / levels / turn / saved_turn / card records),
18
18
  * device-produced like rtm.
19
19
  */
20
20
  export declare const SOURCES: readonly ["rtm", "network", "clog", "trace", "log", "switchboard", "all", "db", "prefs", "flags"];
package/dist/web/spec.js CHANGED
@@ -14,7 +14,7 @@
14
14
  * Sources the dashboard can read. The first five plus "switchboard" are live streams; "all" is
15
15
  * their unified timeline. "db", "prefs", and "flags" are read-only point-in-time browsers (not
16
16
  * streams) and are each handled as a distinct view. "switchboard" is the Slackbot voice transport's
17
- * own event stream (session / state / frame / phase / player / levels / turn / saved_turn records),
17
+ * own event stream (session / state / frame / phase / player / levels / turn / saved_turn / card records),
18
18
  * device-produced like rtm.
19
19
  */
20
20
  export const SOURCES = ["rtm", "network", "clog", "trace", "log", "switchboard", "all", "db", "prefs", "flags"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slack/radar-mcp",
3
- "version": "1.24.0",
3
+ "version": "1.25.0",
4
4
  "description": "MCP server and web dashboard for debugging Slack on Android and iOS Simulator",
5
5
  "type": "module",
6
6
  "main": "dist/mcp/index.js",