SessionDeadline class final

The single session deadline clock (gh-1556). All setters write the one epoch-ms value; every consumer projects it live.

Constructors

SessionDeadline({DateTime clock()?, DeadlineLadder ladder = const DeadlineLadder()})
Creates a clock. clock defaults to DateTime.now; tests inject a fake. ladder defaults to the standard T-3min/T-30s windows.

Properties

deadlineEpochMs → int?
The armed epoch-ms deadline, or null when unarmed.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isArmed → bool
Whether a deadline is currently armed.
no setter
ladder → DeadlineLadder
The notice ladder (thresholds + texts).
final
remainingMs → int
Milliseconds remaining on the armed deadline (negative once passed). Throws StateError when unarmed — check isArmed first.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

budgetLine() → String?
The per-turn budget line for the LLM request context (time-left: 5min), or null when unarmed — the caller then leaves the request payload byte-for-byte untouched.
clear() → void
Clears the deadline: every consumer falls back to today's byte-for-byte behavior.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pollNotices() → List<DeadlineNotice>
The one-shot crossing notices newly reached since the last poll (or the arming). Each ladder crossing fires at most once per arming; a re-set/adjust re-arms the latches. Empty when unarmed or nothing new crossed. Poll sites: the steering poll (turn boundaries), so the notices ride the existing <system-notice> machinery.
setDuration(Duration budget) → void
Arms (or re-arms) the deadline budget from now. Re-arming resets the one-shot notice latches — each crossing fires once per arming.
setEpochMs(int epochMs) → void
Arms (or re-arms) an absolute epoch-ms deadline. A past timestamp is a FormatException — never a silently expired clock. Re-arming resets the one-shot notice latches.
setFromSpec(String spec) → void
Arms the deadline from a user-facing spec (25m, 90s, 1h30m, or a bare epoch-ms integer). Throws FormatException on an invalid or past spec — the caller surfaces the message.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited