v148 · on-device AI

Safety Harness

12 edge-case tests: API availability, invalid performance values, empty and very-long input, model-unavailable recovery, format/length/type combinations, concurrent summarisation, and graceful fallback paths.

Checking Summarizer API…
12Total
0Pass
0Fail
0Warn
Ready. Press "Run all" or individual test buttons.
Test suite
// Defensive Summarizer usage async function safeSummarize(text, pref = 'balanced') { if (!window.Summarizer) return { error: 'not-supported' }; if (!text?.trim()) return { error: 'empty-input' }; const valid = ['fast', 'balanced', 'quality']; if (!valid.includes(pref)) pref = 'balanced'; // clamp const cap = await Summarizer.capabilities(); if (cap.available === 'no') return { error: 'model-unavailable' }; try { const s = await Summarizer.create({ performancePreference: pref }); return { result: await s.summarize(text) }; } catch (e) { return { error: 'inference-error', message: e.message }; } }

see also

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗