Documentation
¶
Overview ¶
Package attention owns core-only eligibility, arbitration, and explanations.
Index ¶
Constants ¶
const ( StateVersion = 1 MaxStateEntries = 2048 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcknowledgementState ¶
type AcknowledgementState struct {
Identity StateIdentity `json:"identity"`
ObservedAt time.Time `json:"observed_at"`
TouchedAt time.Time `json:"touched_at"`
}
type Decision ¶
type Decision struct {
Candidate *presentation.Candidate
Evaluations []Evaluation
}
func Select ¶
func Select(records []observation.Record, resolve Resolver, history presentation.History, now time.Time) Decision
Select applies mode eligibility before delegating deterministic ordering and anti-flap mechanics to presentation.Select.
type DeliveryOutcome ¶
type DeliveryOutcome string
const ( OutcomeDrawn DeliveryOutcome = "drawn" OutcomeCleared DeliveryOutcome = "cleared" OutcomeUnchanged DeliveryOutcome = "unchanged" OutcomeFirmwareSuppressed DeliveryOutcome = "firmware_suppressed_409" OutcomeAssetMissing DeliveryOutcome = "asset_missing" OutcomeInvalidPresentation DeliveryOutcome = "invalid_presentation" )
type Evaluation ¶
type Evaluation struct {
ObservationID string `json:"observation_id"`
PluginID string `json:"plugin_id"`
InstanceID string `json:"instance_id"`
Channel string `json:"channel"`
Policy presentation.Policy `json:"policy,omitempty"`
Disposition protocol.Disposition `json:"disposition"`
Impact protocol.Impact `json:"impact"`
Band presentation.Band `json:"band,omitempty"`
ReasonCode string `json:"reason_code"`
Reason Reason `json:"reason"`
EvaluatedAt time.Time `json:"evaluated_at"`
CooldownUntil time.Time `json:"cooldown_until,omitempty"`
NextDue time.Time `json:"next_due,omitempty"`
}
Evaluation is safe to expose through status and persist in decision history.
type LastShownState ¶
type LastShownState struct {
Identity StateIdentity `json:"identity"`
ShownAt time.Time `json:"shown_at"`
}
type Reason ¶
type Reason string
Reason is a stable, non-sensitive explanation for one evaluation.
const ( ReasonSelected Reason = "selected" ReasonDisabled Reason = "disabled" ReasonAssetsPending Reason = "assets_pending" ReasonStale Reason = "stale" ReasonExpired Reason = "expired" ReasonResolved Reason = "resolved" ReasonNotActionableForAttention Reason = "not_actionable_for_attention" ReasonNotRelevant Reason = "not_relevant" ReasonNotDue Reason = "not_due" ReasonAcknowledged Reason = "acknowledged" ReasonCooldownUntil Reason = "cooldown_until" ReasonHeldByCurrent Reason = "held_by_current" ReasonLowerBand Reason = "lower_band" ReasonLowerImpact Reason = "lower_impact" ReasonFairnessWait Reason = "fairness_wait" ReasonForegroundInactive Reason = "foreground_inactive" ReasonBlockedByAtomicExecution Reason = "blocked_by_atomic_execution" )
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder keeps bounded in-memory decisions and a rotated local JSONL ledger.
func NewRecorder ¶
func (*Recorder) Status ¶
func (r *Recorder) Status() RecorderStatus
type RecorderPhase ¶
type RecorderPhase string
const ( RecorderHealthy RecorderPhase = "healthy" RecorderDegraded RecorderPhase = "degraded" )
type RecorderStatus ¶
type RecorderStatus struct {
Phase RecorderPhase `json:"phase"`
LastErrorCode string `json:"last_error_code,omitempty"`
LastErrorAt time.Time `json:"last_error_at,omitempty"`
LastSuccessAt time.Time `json:"last_success_at,omitempty"`
LastTraceAt time.Time `json:"last_trace_at,omitempty"`
LastSequence uint64 `json:"last_sequence"`
}
RecorderStatus exposes recorder freshness without leaking paths or raw I/O errors.
type Rule ¶
type Rule struct {
Enabled bool
AssetsReady bool
Policy presentation.Policy
DevicePriority int
HoldMS int
CooldownMS int
RequiresAck bool
Acknowledged bool
Foreground bool
RotationIntervalMS int
RotationJitterPercent int
BlockedByAtomicExecution bool
}
Rule is core-owned configuration and runtime state for one observation.
type StateDocument ¶
type StateDocument struct {
Version int `json:"version"`
Acknowledgements []AcknowledgementState `json:"acknowledgements"`
LastShown []LastShownState `json:"last_shown"`
}
type StateError ¶
func (*StateError) Error ¶
func (e *StateError) Error() string
func (*StateError) Unwrap ¶
func (e *StateError) Unwrap() error
type StateIdentity ¶
type StateIdentity struct {
PluginID string `json:"plugin_id"`
InstanceID string `json:"instance_id"`
Generation uint64 `json:"generation"`
Channel string `json:"channel"`
Key string `json:"key"`
}
func (StateIdentity) Validate ¶
func (i StateIdentity) Validate() error
type StateStore ¶
type StateStore struct {
// contains filtered or unexported fields
}
func NewStateStore ¶
func NewStateStore(path string) *StateStore
func (*StateStore) Load ¶
func (s *StateStore) Load() (StateDocument, error)
func (*StateStore) Save ¶
func (s *StateStore) Save(document StateDocument) (localstate.CommitOutcome, error)
func (*StateStore) Status ¶
func (s *StateStore) Status() StateStoreStatus
type StateStoreStatus ¶
type Trace ¶
type Trace struct {
Sequence uint64 `json:"sequence"`
At time.Time `json:"at"`
SelectedID string `json:"selected_id,omitempty"`
Outcome DeliveryOutcome `json:"outcome,omitempty"`
Evaluations []Evaluation `json:"evaluations"`
}