proposals

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 11 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 proposals is the job that proposes what each enabled plugin proposes on its own units, such as GitHub's nudge. Every draft waits for its rule's approval policy. The drafts on GTD entries and Slack units come from the profile's workflows through draft.propose.

Index

Constants

View Source
const ReasonMoot = draft.WithdrawMoot

ReasonMoot is the discard reason of a plugin rule's draft on a unit whose closure is posted.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	Outbox Outbox
	// Facts reads a unit's card facts; a plugin rule's draft on a unit whose closure is posted is withdrawn. nil: none.
	Facts   coregtd.Facts
	Sources []Source
	// Enabled says whether a provider's plugin is enabled; nil: every one is.
	Enabled func(unit.ProviderID) bool
	// Approval is the configured approval of a plugin's rules' drafts; nil: wait.
	Approval func(unit.ProviderID) draft.Approval
	// RepeatAfter is how long a sent, discarded or dry-run draft of a key keeps the key quiet.
	RepeatAfter time.Duration
	Clock       port.Clock
	Log         func(format string, args ...any) // ids, rules, kinds and units; never text
	// contains filtered or unexported fields
}

func (*Job) Run

func (j *Job) Run(ctx context.Context) (Summary, error)

Run is one pass: it withdraws the plugin rules' drafts on units whose closure is posted, then proposes what every plugin calls for now and no draft of the same rule and key holds back.

func (*Job) Watch

func (j *Job) Watch(ctx context.Context, changes port.Changes, debounce, every time.Duration)

Watch runs a pass at once, then a pass debounce after a TopicEntries or TopicItems note, and a pass every period for staleness, until ctx ends.

type Outbox

type Outbox interface {
	Propose(ctx context.Context, p outbox.Proposal) (draft.Draft, error)
	List(ctx context.Context, f outbox.Filter) ([]draft.Draft, error)
	Discard(ctx context.Context, id draft.ID, reason string) (draft.Draft, error)
}

Outbox is what the job needs of the outbox service (*outbox.Service).

type Source

type Source struct {
	Provider  unit.ProviderID
	Proposals func(ctx context.Context, now time.Time) ([]outbox.Proposal, error)
}

Source is an enabled plugin's Proposals.

type Summary

type Summary struct {
	Proposed, Held, Discarded, Refused int
}

Summary counts what one pass did.

func (Summary) String

func (s Summary) String() string

Jump to

Keyboard shortcuts

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