nudges

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package nudges tracks lightweight user-facing guidance and follow-up prompts.

Package nudges tracks recurring external nudges and acknowledgements.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Delivery

type Delivery struct {
	NudgeID     string
	CycleID     string
	Prompt      string
	DeliveredAt time.Time
	ResponseID  string
}

Delivery is one incoming nudge delivery.

type Observation

type Observation struct {
	Kind                string    `json:"kind"`
	NudgeID             string    `json:"nudge_id"`
	CycleID             string    `json:"cycle_id"`
	Fingerprint         string    `json:"fingerprint"`
	State               State     `json:"state"`
	DeliveryCount       int       `json:"delivery_count"`
	DeliveredAt         time.Time `json:"delivered_at"`
	AlreadyAcknowledged bool      `json:"already_acknowledged"`
	Acknowledged        bool      `json:"acknowledged"`
	Stale               bool      `json:"stale"`
	ResponseID          string    `json:"response_id,omitempty"`
	Record              Record    `json:"record"`
}

Observation is returned after recording or acknowledging a delivery.

type Record

type Record struct {
	NudgeID          string     `json:"nudge_id"`
	CycleID          string     `json:"cycle_id"`
	Fingerprint      string     `json:"fingerprint"`
	FirstDeliveredAt time.Time  `json:"first_delivered_at"`
	LastDeliveredAt  time.Time  `json:"last_delivered_at"`
	DeliveryCount    int        `json:"delivery_count"`
	LastPrompt       string     `json:"last_prompt,omitempty"`
	Acknowledged     bool       `json:"acknowledged"`
	AcknowledgedAt   *time.Time `json:"acknowledged_at,omitempty"`
	ResponseID       string     `json:"response_id,omitempty"`
	LastState        State      `json:"last_state"`
}

Record is the persisted state for one nudge cycle.

type State

type State string

State describes how the current delivery relates to prior nudge state.

const (
	StateNew            State = "new_nudge"
	StateRetry          State = "retry_nudge"
	StateStaleDuplicate State = "stale_duplicate"
)

type Store

type Store struct {
	Dir string
}

Store persists nudge cycle records under the Codog config home.

func NewStore

func NewStore(configHome string) Store

NewStore returns a nudge store rooted at configHome.

func (Store) Acknowledge

func (s Store) Acknowledge(delivery Delivery) (Observation, error)

Acknowledge records that Codog handled a nudge cycle.

func (Store) Get

func (s Store) Get(nudgeID string, cycleID string) (Record, error)

Get loads one nudge cycle record.

func (Store) List

func (s Store) List() ([]Record, error)

List returns all records, newest delivery first.

func (Store) Observe

func (s Store) Observe(delivery Delivery) (Observation, error)

Observe records a delivery and classifies it as new, retry, or stale.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL