- Clock API routes: start, pause, resume, advance, rewind, jump, get, warnings - Role-based access control (floor+ for mutations, any auth for reads) - Clock state persistence callback to DB on meaningful changes - Blind structure levels loaded from DB on clock start - Clock registry wired into HTTP server and cmd/leaf main - 25 tests covering: state machine, countdown, pause/resume, auto-advance, jump, rewind, hand-for-hand, warnings, overtime, crash recovery, snapshot - Fix missing crypto/rand import in auth/pin.go (Rule 3 auto-fix) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
14 lines
639 B
Go
14 lines
639 B
Go
package clock
|
|
|
|
// DefaultWarningThresholds returns the default warning thresholds (60s, 30s, 10s).
|
|
// This is re-exported here for convenience; the canonical implementation
|
|
// is DefaultWarnings() in engine.go.
|
|
//
|
|
// Warning system behavior:
|
|
// - Warnings fire when remainingNs crosses below a threshold
|
|
// - Each threshold fires at most once per level (tracked in emittedWarnings map)
|
|
// - On level change, emittedWarnings is reset
|
|
// - Warning events are broadcast via WebSocket with type "clock.warning"
|
|
//
|
|
// The warning checking logic is implemented in ClockEngine.checkWarningsLocked()
|
|
// in engine.go, called on every tick.
|