Documentation
¶
Overview ¶
Package draft holds the Outbox drafts: posts the loop proposes and the user approves before they reach a provider.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrTransition = errors.New("draft: transition not allowed")
ErrTransition is wrapped by Can.
View Source
var Open = []State{Proposed, Approved, Sending}
Open are the states in which a draft may still be posted.
Functions ¶
This section is empty.
Types ¶
type Approval ¶
type Approval struct {
Mode ApprovalMode
Window time.Duration // Mode "window" only, > 0
}
type ApprovalMode ¶
type ApprovalMode string // "always" (default), "window", "none", "observe"
const ( Always ApprovalMode = "always" Window ApprovalMode = "window" None ApprovalMode = "none" Observe ApprovalMode = "observe" )
type Draft ¶
type Draft struct {
ID ID
Unit unit.Unit
Items []string // item ids of Unit; may be empty
Entry string // the entry it serves, "" none; the Outbox entry itself is "draft:<ID>"
Kind Kind
Target string // plugin target grammar; "" means the unit itself (its thread, its PR)
Text string // standard Markdown with mentions as @{<person key>}; the Effects implementation converts both
Reaction string // Kind "react" only: emoji name without colons
Original string // Text as proposed
Edited bool // Text != Original
Origin Origin
Approval Approval // fixed at proposal
Deadline time.Time // Approval.Mode "window": when Tick approves it; zero otherwise
State State
Evidence Evidence // State "sent" only
Error string // State "failed" only, never a token
Reason string // State "discarded": "user", "assigned", "observe", ...
Would Would
Rev int64 // the stored row's version; every Update bumps it
CreatedAt, UpdatedAt, SendingAt time.Time
}
type Origin ¶
type Origin struct {
Kind OriginKind
TurnSeq int64 // Kind "turn": the turn (session or headless) that proposed it; Kind "session": the handle's newest turn on the unit, 0 none
Intent string // the proposing turn's intent ("" for auto and user)
Workflow string // the workflow that started the proposing turn (turn.Turn.Workflow), "" none
Rule string // Kind "auto": the core or plugin rule, e.g. "stalled-nudge", "closure", "ask-owner", "github-nudge"
Key string // Kind "auto": the rule's dedupe key, e.g. "stalled-nudge:<entry>:<person key>"
}
type OriginKind ¶
type OriginKind string // "turn", "session", "auto", "user"
const ( OriginTurn OriginKind = "turn" OriginSession OriginKind = "session" OriginAuto OriginKind = "auto" OriginUser OriginKind = "user" )
type Outcome ¶
type Outcome string // "", "as_is", "edited", "discarded", "auto" (approved by its policy), "observed" (recorded only)
type Would ¶
type Would struct {
Policy WouldPolicy // what auto-send would have done, fixed at proposal
Reason string // why, one line
Outcome Outcome // what the user (or the policy) did, set at approve or discard
}
type WouldPolicy ¶
type WouldPolicy string // "send", "hold"
const ( WouldSend WouldPolicy = "send" WouldHold WouldPolicy = "hold" )
Click to show internal directories.
Click to hide internal directories.