MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / queueToast

Function queueToast

plugin/hooks/register.js:1407–1423  ·  view source on GitHub ↗
($, lines, epoch)

Source from the content-addressed store, hash-verified

1405// One toast per burst, on the same clock as the lines relayed to Claude: a
1406// burst ends after WATCH_BURST_MS of quiet, or WATCH_BURST_MAX_MS after it began.
1407async function queueToast($, lines, epoch) {
1408 toastLines.push(...lines)
1409 const now = await $.clock.now()
1410 if (epoch !== seenEpoch) return
1411 if (!toastStart) toastStart = now
1412 if (toastTimer) toastTimer.cancel()
1413 const wait = Math.max(0, Math.min(WATCH_BURST_MS, toastStart + WATCH_BURST_MAX_MS - now))
1414 toastTimer = $.clock.after(wait, () => {
1415 toastTimer = null
1416 toastStart = 0
1417 const burst = toastLines
1418 toastLines = []
1419 if (!burst.length) return
1420 const last = clipLine(burst[burst.length - 1], 120)
1421 $.ui.toast(burst.length > 1 ? last + ' (+' + (burst.length - 1) + ' more)' : last)
1422 })
1423}
1424
1425function drawSeenBand($, e) {
1426 const { Box, Text } = $.ui.resolve(e)

Callers 1

pollSeenFunction · 0.85

Calls 4

clipLineFunction · 0.85
pushMethod · 0.80
cancelMethod · 0.65
nowMethod · 0.45

Tested by

no test coverage detected