ExklusivBeta
Quiet Alarm <mv-quiet-alarm>
Ein Abwesenheitsdetektor: Er schlägt Alarm, wenn etwas, das normalerweise passiert, nicht mehr passiert (Bestellungen, Webhooks, WebSocket-Nachrichten, Sensorwerte, Logzeilen). Die App liefert Beats mit beat(), einem benannten DOM-Event (listen) oder Zeilen, die in einem beobachteten Bereich hinzukommen (watch); die Komponente lernt den üblichen Rhythmus aus robusten Statistiken der Abstände (Median und 90. Perzentil der letzten 40 Lücken, Ausreißer und frühere Vorfälle ausgenommen) oder übernimmt ein erwartetes Intervall und eskaliert von learning → normal → overdue → silent, wenn die aktuelle Stille länger als üblich ist: „Unusually quiet · no new orders for 14 min (usually every 2 min)“. Ein kompakter Rhythmusstreifen zeichnet die letzten Beats als Striche, die an einer festen „now“-Markierung vorbei nach links gleiten, davor schattiert das Fenster, in dem der nächste Beat erwartet wird, danach schraffiert die Zonen overdue und silent, sodass du siehst, dass der nächste Beat zu spät ist, bevor ein Alarm kommt. Stille wird in aktiver Zeit gemessen: Ruhezeiten ("22:00-07:00, Sat-Sun 00:00-24:00") und erwartete Pausen (pause("20m", { reason })) zählen nie und werden als Bänder gezeichnet. Snooze schaltet den Alarm stumm, ohne über den Zustand zu lügen, und endet mit dem nächsten Beat; ein abbrechbares mv-escalate lässt die App einen Alarm unterbinden, den sie erklären kann, ein abbrechbares mv-beat filtert Beats, und mv-resume meldet, wie lange der Ausfall dauerte. seed() füllt den Rhythmus aus der Server-Historie vor, und persist behält ihn über Neuladen hinweg, sodass ein Dashboard nach einem Refresh nie blind ist. Eine Karten- und eine Inline-Variante (Header oder Toolbar).
| Kategorie | Feedback |
|---|---|
| Typ | Web Component (<mv-quiet-alarm>) |
| Status | Beta |
| Kit | Monitoring ohne Alarmmüdigkeit |
| Installiert auch | button |
| Keywords | exclusive, culture, absence, heartbeat, watchdog, monitoring, anomaly, silence, rhythm, inter-arrival, ops, dashboard, e-commerce, iot, websocket, webhook, alert, status, snooze, quiet-hours |
When to use
- An ops or e-commerce dashboard must notice when orders, sign-ups or payments quietly stop arriving, not just when errors appear
- A webhook, websocket or job queue can fail silently and the only symptom is that its messages stop coming
- IoT or monitoring screens show sensors that report on a rhythm and a missing reading matters more than a bad one
- A support or chat backend should flag an unusually long lull in incoming conversations during business hours
Avoid when
- The deadline is fixed and known in advance (a session or an offer that ends at a set time) → use Hatch instead
- You need to show what did change while the user was away, not what failed to happen → use While Away instead
- The content is edited by hand and should just look stale after a while without review → use Dorian instead
Installation
node scripts/add.mjs quiet-alarm --out ./src/marvelousKI-Agent mit dem MCP-Server von Marvelous UI: install_components({ slugs: ["quiet-alarm"], target_dir: "<absolute path>/src/marvelous", framework: "react" }).
Kopierte Dateien (inklusive Abhängigkeiten): tokens/tokens.css, core/base.css, core/dom.js, core/element.js, core/motion.js, core/observe.js, components/quiet-alarm/quiet-alarm.js, components/quiet-alarm/quiet-alarm.css, components/button/button.css.
Verwendung
Schnellstart mit dem kleinsten funktionierenden Markup:
<mv-quiet-alarm label="Orders · US storefront" subject="orders" expected="5m" listen="order:created"></mv-quiet-alarm>Referenz-Markup zum Starten und Anpassen mit Attributen, data-* und CSS-Variablen:
<div id="qa-demo" style="width:min(100%,60rem);margin-inline:auto">
<style>
#qa-demo { display:grid; gap:1rem; align-content:start }
#qa-demo .qa-bar { display:flex; align-items:center; justify-content:space-between; gap:.75rem 1rem; flex-wrap:wrap; padding:.625rem .75rem .625rem 1rem; border:1px solid var(--mv-border); border-radius:var(--mv-radius-xl); background:var(--mv-surface) }
#qa-demo .qa-brand { display:flex; align-items:center; gap:.625rem; min-width:0 }
#qa-demo .qa-logo { display:grid; place-items:center; flex:none; width:1.875rem; height:1.875rem; border-radius:var(--mv-radius-md); background:var(--mv-accent); color:var(--mv-fg-on-accent) }
#qa-demo .qa-logo svg { width:1rem; height:1rem }
#qa-demo .qa-brand b { display:block; font-size:.9375rem; letter-spacing:-.01em }
#qa-demo .qa-brand span { display:block; color:var(--mv-fg-muted); font-size:.75rem }
#qa-demo .qa-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem }
#qa-demo .qa-panel { min-width:0; padding:1rem; border:1px solid var(--mv-border); border-radius:var(--mv-radius-xl); background:var(--mv-surface) }
#qa-demo .qa-panel h4 { display:flex; align-items:center; justify-content:space-between; gap:.5rem; margin:0 0 .75rem; font-size:.8125rem; font-weight:600 }
#qa-demo .qa-panel h4 span { color:var(--mv-fg-subtle); font-weight:500; font-size:.75rem }
#qa-demo .qa-feed { list-style:none; margin:0; padding:0; display:grid; gap:.375rem }
#qa-demo .qa-feed li { display:grid; grid-template-columns:4.25rem minmax(0,1fr) auto; gap:.75rem; align-items:center; padding:.4375rem .625rem; border-radius:var(--mv-radius-md); background:var(--mv-bg-subtle); font-size:.8125rem; font-variant-numeric:tabular-nums }
#qa-demo .qa-feed li:first-child { animation:qa-in var(--mv-duration-slow) var(--mv-ease-out) }
#qa-demo .qa-feed .qa-id { color:var(--mv-fg-subtle); font:.75rem var(--mv-font-mono) }
#qa-demo .qa-feed .qa-who { overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
#qa-demo .qa-feed .qa-who small { color:var(--mv-fg-muted); font-size:.75rem }
#qa-demo .qa-feed .qa-amt { font-weight:600 }
@keyframes qa-in { from { opacity:0; translate:0 -4px } }
#qa-demo .qa-controls { display:grid; gap:.875rem }
#qa-demo .qa-row { display:flex; align-items:center; justify-content:space-between; gap:.75rem; flex-wrap:wrap }
#qa-demo .qa-row > span { font-size:.8125rem; color:var(--mv-fg-muted) }
#qa-demo .qa-actions { display:flex; gap:.5rem; flex-wrap:wrap }
#qa-demo .qa-log { list-style:none; margin:0; padding:.625rem .75rem; display:grid; gap:.25rem; min-height:4.75rem; border-radius:var(--mv-radius-md); background:var(--mv-bg-subtle); color:var(--mv-fg-muted); font:.75rem/1.5 var(--mv-font-mono) }
#qa-demo .qa-log b { color:var(--mv-fg); font-weight:600 }
#qa-demo .qa-note { margin:0; color:var(--mv-fg-subtle); font-size:.75rem; text-align:center }
@media (prefers-reduced-motion: reduce) { #qa-demo .qa-feed li:first-child { animation:none } }
@media (max-width:44rem) { #qa-demo .qa-grid { grid-template-columns:minmax(0,1fr) } }
</style>
<header class="qa-bar">
<div class="qa-brand">
<span class="qa-logo" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 9h16l-1.2 10.2a2 2 0 0 1-2 1.8H7.2a2 2 0 0 1-2-1.8z"/><path d="M8.5 9V7a3.5 3.5 0 0 1 7 0v2"/></svg></span>
<div><b>Northwind Market · Operations</b><span>US storefront · all systems</span></div>
</div>
<mv-quiet-alarm id="qa-sensor" variant="inline" label="Cold room 3" subject="readings" expected="3s" snooze-for="1m"></mv-quiet-alarm>
</header>
<div class="qa-grid">
<mv-quiet-alarm id="qa-orders" label="Orders · US storefront" subject="orders" watch="#qa-feed" snooze-for="30s"></mv-quiet-alarm>
<mv-quiet-alarm id="qa-hooks" label="Payment webhooks" subject="webhooks" listen="payment:webhook" listen-on="#qa-demo" snooze-for="20s"></mv-quiet-alarm>
<section class="qa-panel" aria-labelledby="qa-feed-h">
<h4 id="qa-feed-h">Live orders <span>newest first</span></h4>
<ul class="qa-feed" id="qa-feed" aria-label="Latest orders">
<li><span class="qa-id">#10481</span><span class="qa-who">Kenji Watanabe <small>· Osaka</small></span><span class="qa-amt">$42.90</span></li>
<li><span class="qa-id">#10480</span><span class="qa-who">Sofia Rossi <small>· Milan</small></span><span class="qa-amt">$128.00</span></li>
<li><span class="qa-id">#10479</span><span class="qa-who">Amara Okafor <small>· Lagos</small></span><span class="qa-amt">$64.50</span></li>
<li><span class="qa-id">#10478</span><span class="qa-who">Lucas Martin <small>· Lyon</small></span><span class="qa-amt">$19.99</span></li>
</ul>
</section>
<section class="qa-panel qa-controls" aria-labelledby="qa-sim-h">
<h4 id="qa-sim-h" style="margin:0">Simulation <span>time runs in seconds here</span></h4>
<label class="mv-choice" data-control="end">
<input type="checkbox" role="switch" class="mv-switch" id="qa-flow" checked>
<span class="mv-choice-text"><span class="mv-choice-title">Orders flowing</span><span class="mv-choice-description">Turn off to simulate a broken checkout</span></span>
</label>
<div class="qa-row">
<span id="qa-sens-l">Orders sensitivity</span>
<mv-segmented id="qa-sens" aria-labelledby="qa-sens-l" value="normal">
<button value="low">Low</button>
<button value="normal">Normal</button>
<button value="high">High</button>
</mv-segmented>
</div>
<div class="qa-actions">
<button type="button" class="mv-button" data-variant="outline" data-size="sm" id="qa-deploy">Pause orders 20 s (deploy)</button>
<button type="button" class="mv-button" data-variant="outline" data-size="sm" id="qa-hook">Deliver a webhook</button>
</div>
<ol class="qa-log" id="qa-log" aria-label="State changes"><li>State changes appear here.</li></ol>
</section>
</div>
<p class="qa-note">Each monitor learns its own rhythm from the beats it sees and only speaks up when the silence is longer than usual.</p>
<script type="module">
const root = document.getElementById("qa-demo");
await customElements.whenDefined("mv-quiet-alarm");
const $ = (id) => document.getElementById(id);
const orders = $("qa-orders"), hooks = $("qa-hooks"), sensor = $("qa-sensor");
const feed = $("qa-feed"), log = $("qa-log");
const timers = new Set();
const later = (fn, ms) => { const t = setTimeout(() => { timers.delete(t); if (root.isConnected) fn(); }, ms); timers.add(t); };
// Deterministic history so the page opens on a real rhythm.
let s = 20260923;
const rnd = () => ((s = (s * 16807) % 2147483647) / 2147483647);
const history = (count, min, max, endAgo) => {
const out = [];
let t = Date.now() - endAgo;
for (let i = 0; i < count; i++) { out.unshift(t); t -= (min + rnd() * (max - min)); }
return out;
};
orders.seed(history(22, 1200, 3200, 900));
hooks.seed(history(18, 1100, 1900, 5200)); // stopped five seconds ago
sensor.seed(history(12, 2900, 3100, 1400));
// Orders: rows appended to the watched feed are the beats.
const people = [["Priya Nair", "Bengaluru"], ["Mateo García", "Madrid"], ["Emma Schneider", "Berlin"], ["Noah Williams", "Austin"], ["Aisha Rahman", "Dubai"], ["Chloé Dubois", "Montréal"], ["Liam O'Brien", "Dublin"], ["Yuna Kim", "Seoul"], ["Lucas Martin", "Lyon"], ["Amara Okafor", "Lagos"]];
let id = 10481;
const addOrder = () => {
const [name, city] = people[id % people.length];
const li = document.createElement("li");
const a = Object.assign(document.createElement("span"), { className: "qa-id", textContent: `#${++id}` });
const who = Object.assign(document.createElement("span"), { className: "qa-who", textContent: `${name} ` });
who.append(Object.assign(document.createElement("small"), { textContent: `· ${city}` }));
const amt = Object.assign(document.createElement("span"), { className: "qa-amt", textContent: `$${(12 + rnd() * 180).toFixed(2)}` });
li.append(a, who, amt);
feed.prepend(li);
while (feed.children.length > 4) feed.lastElementChild.remove();
};
const flow = $("qa-flow");
const orderLoop = () => { if (flow.checked) addOrder(); later(orderLoop, 1200 + rnd() * 2000); };
later(orderLoop, 1300);
// Sensor: the app calls beat() on every reading.
const sensorLoop = () => { sensor.beat(); later(sensorLoop, 2900 + rnd() * 200); };
later(sensorLoop, 1600);
// Webhooks: a DOM event on the demo root is a beat.
$("qa-hook").addEventListener("click", () => root.dispatchEvent(new CustomEvent("payment:webhook", { detail: { count: 1 } })));
$("qa-deploy").addEventListener("click", () => orders.pause("20s", { reason: "a deploy" }));
$("qa-sens").addEventListener("mv-change", (e) => { orders.sensitivity = e.detail.value; });
const clock = new Intl.DateTimeFormat("en-US", { hour: "numeric", minute: "2-digit", second: "2-digit" });
const names = { learning: "Learning", normal: "Normal", overdue: "Overdue", silent: "Silent", paused: "Paused" };
root.addEventListener("mv-change", (e) => {
if (e.target.localName !== "mv-quiet-alarm") return;
const li = document.createElement("li");
const b = Object.assign(document.createElement("b"), { textContent: e.target.label });
li.append(`${clock.format(new Date())} · `, b, ` → ${names[e.detail.state]}`);
if (!log.querySelector("b")) log.replaceChildren();
log.prepend(li);
while (log.children.length > 3) log.lastElementChild.remove();
});
</script>
</div>Kulturelle Referenz
Silberstern, Arthur Conan Doyle (1892, Buch). Der entscheidende Hinweis ist der merkwürdige Vorfall mit dem Hund in der Nacht: Der Hund tat nichts, und ein Detektiv bemerkt das Ausbleiben eines Ereignisses, das hätte eintreten müssen. In der UI lernt die Komponente, was normalerweise wann passiert, und schlägt genau dann Alarm, wenn ein erwarteter Beat ausbleibt.
API
Attributes
| Name | Typ | Default | Description |
|---|---|---|---|
label | string | Activity | What is watched, shown as the title and used as the group's accessible name and in announcements (“Orders · US storefront”). |
subject | string (plural noun) | events | Plural noun used in sentences: “no new {subject} for 14 min”, “Waiting for {subject}”. |
subject-one | string | Singular noun (“Last {one} 40 sec ago”). Defaults to subject without its final s; set it for irregular nouns. | |
expected | time ("2m", "30s", "1h", ms number) | Known interval between beats. Skips learning, becomes the typical gap, and silence counts from the first connection even before any beat (“no new orders for 14 min” on a page that never saw one). | |
sensitivity | low | normal | high | number | normal | Multiplies the automatic thresholds: low = 1.5 (more tolerant), normal = 1, high = 0.7; a number is used as is. Overdue = k × max(2.5 × typical, 1.5 × p90); silent = max(1.6 × overdue, k × max(6 × typical, 3 × p90)). |
overdue-after / silent-after | time | Absolute thresholds in active time, overriding the learned ones (silent is kept at least 1.25 × overdue). | |
learn | number | 6 | Beats to see before the rhythm is trusted (the learning state shows “3 of 6 orders so far”). Ignored with expected. |
memory | number | 40 | How many recent gaps the statistics use, so the rhythm follows the time of day. Gaps interrupted by a pause or quiet hours, gaps longer than 12 × the median, and silences that reached silent are never learned; an overdue gap is, so a lasting slowdown is absorbed after a few beats. |
quiet-hours | string | Comma-separated local time ranges when silence is expected and never counts: "22:00-07:00" (overnight wraps), "Sat-Sun 00:00-24:00", "Mon 12:00-13:00". The state is paused while inside one (“Quiet hours · alerts resume at 7:00 AM”) and the ranges are drawn as bands on the strip. | |
listen | string | Event type(s), space- or comma-separated, that count as a beat ("order:created"). A numeric event.detail.count counts as a burst of that many. | |
listen-on | window | document | self | CSS selector | window | Where the listen events are caught (window also receives bubbling events from anywhere in the page). |
watch | CSS selector | Element(s) whose new direct children count as beats (a feed, a log, a table body); rows added together are one beat of N. Elements matching later are picked up automatically; removals are ignored. | |
snooze-for | time | 30m | Duration of the built-in Snooze button shown while overdue or silent, and default for snooze(). "0" hides the button. |
span | time | Past time range drawn on the strip. Auto by default: a round value (10 s … 7 d) covering about 12 typical gaps and the silent threshold; the future quarter to the right of now shows the expected-next window. | |
variant | card | inline | card | inline: one row (icon, label, short status, mini strip, icon-only actions) for headers, toolbars and table cells. |
announce | "off" | "off" silences the live-region announcements (visible status and events stay). | |
persist | string | localStorage key suffix: the recent beats are saved and restored on reload, so learning is not lost (storage failures are ignored). | |
locale | BCP 47 | en-US | Locale for durations (Intl unit format) and clock times. |
data-state | learning | normal | overdue | silent | paused | Set by the component (styleable). data-snoozed is added while snoozed. |
Properties
| Name | Typ | Description |
|---|---|---|
state | "learning" | "normal" | "overdue" | "silent" | "paused" | Current state (read-only). |
silence | number (ms) | Active time since the last beat, quiet hours and pauses excluded (read-only). |
typical | number (ms) | null | Expected interval, or the learned median gap; null while learning (read-only). |
thresholds | { overdueAfter, silentAfter } | null | Current thresholds in active ms (read-only). |
lastBeat | Date | null | Time of the latest beat (read-only). |
beats | { at: Date, count }[] | Recorded beats, oldest first (read-only copy). |
paused | { reason, until: Date | null } | null | Current pause or quiet period (reason "quiet-hours" for the latter). |
snoozedUntil | Date | null | End of the current snooze (read-only). |
strings | Partial<Record<string, string>> | Overrides for every visible text and announcement, with {placeholders} (keys: learning, normal, overdue, silent, paused, snoozedPill, waiting, learningText, normalText, watchingText, overdueText, silentText, pausedText, pausedOpenText, quietText, snoozedSuffix, short*, justNow, ago, snooze, unsnooze, resume, spanAgo, now, strip, stripLast, stripNext, announceOverdue, announceSilent, announceResume, announceSnooze, announceUnsnooze). English defaults. |
label / subject / expected / sensitivity / quietHours / listen / watch / snoozeFor / span / variant … | reflected | Mirror the attributes. |
Methods
| Name | Description |
|---|---|
beat({ at?, count?, source? }) | Something happened (at defaults to now; a Date or ms number is also accepted directly). Beats less than 100 ms apart merge into one burst. Emits the cancelable mv-beat; returns false when vetoed. |
seed(times) | Primes the rhythm with past beats (Date, ms or { at, count }) from your server, without events, so the monitor starts in a real state. |
pause(duration?, { reason? }) | Expected pause (deploy, maintenance, store closed): silence stops counting until it ends; open-ended without a duration. The state is paused with a Resume button. |
resume() | Ends the current pause now. |
snooze(duration?) | Mutes announcements and calms the alarm look for a while (default snooze-for), without changing the state; ends early on the next beat. Emits the cancelable mv-snooze. |
unsnooze() | Ends the snooze; an ongoing alarm is announced again. |
reset() | Forgets beats, pauses and snooze and starts learning again. |
Events
| Name | Description |
|---|---|
mv-beat | Cancelable, before a beat is recorded. detail: { at, count, source: "api" | "event" | "mutation", event, nodes }. preventDefault() ignores it (e.g. keep only rows with a given class). |
mv-escalate | Cancelable, before entering overdue or silent. detail: { from, to, silence, typical, overdueAfter, silentAfter }. preventDefault() vetoes that level until the next beat (a vetoed overdue can still become silent later). |
mv-change | The state changed. detail: { state, previous, silence, typical, snoozed, pause }. |
mv-resume | A beat ended an alarm. detail: { silence (ms of active silence), previous ("overdue" | "silent"), at, count }. |
mv-snooze | Cancelable, before a snooze. detail: { until, duration }. |
Content structure
| Name | Description |
|---|---|
actions | Children with slot="actions" (a runbook link, “Open status page”) are placed next to the built-in Snooze / Resume buttons. Any other children are replaced by the generated UI. |
CSS classes
| Name | Description |
|---|---|
mv-quiet-alarm-head | Row with -icon (data-icon per state, one-shot ping on each beat, slow beacon while alarmed), -title, -pill (state word + icon) and -actions (.mv-quiet-alarm-snooze / -unsnooze / -resume). |
mv-quiet-alarm-text | The status sentence; the part before “ · ” is in <strong>. |
mv-quiet-alarm-strip | role="img" rhythm strip: -track, -reel (slides with time), -tick (data-last, data-kind="resume", --_h = burst height), -silence (flat line since the last beat), -zone[data-zone="window | overdue | silent"], -usual (dashed typical mark), -band (pauses and quiet hours), -now, -axis. |
CSS variables
| Name | Default | Description |
|---|---|---|
--mv-quiet-alarm-normal | var(--mv-success) | Normal state and expected-next window tint. |
--mv-quiet-alarm-learning | var(--mv-info) | Learning state tint. |
--mv-quiet-alarm-overdue | var(--mv-warning) | Overdue state and zone. |
--mv-quiet-alarm-silent | var(--mv-danger) | Silent state and zone. |
--mv-quiet-alarm-paused | var(--mv-fg-subtle) | Paused state. |
--mv-quiet-alarm-height | 2.75rem | Height of the strip (card variant). |
--mv-quiet-alarm-inline-width | 6.5rem | Width of the mini strip in the inline variant. |
Accessibility
The element is a role="group" named by its label and described by the status sentence, which is always visible as text (in the inline variant a visually hidden copy of the full sentence is the description, the short text is aria-hidden). State is never conveyed by color alone: each state has its own icon and word in the pill (Learning, Normal, Overdue, Silent, Paused, plus “Snoozed”), the silence line changes from solid to dashed to thick, and the overdue and silent zones are hatched with different densities. The visible text updates every second but is not a live region, so nothing chatters; transitions are announced once in dedicated live regions: entering overdue politely, entering silent assertively, a resumption politely (“Orders: orders resumed after 14 minutes of silence”), snooze and unsnooze politely; announcements are skipped while snoozed and at page load, and announce="off" silences them. The rhythm strip is role="img" with a text summary (“22 orders in the last 45 seconds. Last one 2 sec ago. Next expected within 4 seconds.”) and is otherwise non-interactive. Snooze, Resume alerts and Resume are native buttons (icon-only with aria-label and title in the inline variant) that appear only when relevant; focus is never moved. Reduced motion (OS or data-motion="reduce"): the strip steps instead of sliding, the beat ping, new-tick grow and alarm beacon are off. Forced colors: ticks, now marker, pill and borders use system colors; silent adds a thicker border. Timers are derived from Date.now() (robust to throttled background tabs, catches up on return), rendering pauses when the element is offscreen or the tab hidden while state changes and events still fire on time, and every listener, observer and timer stops when the element is removed.