Documentation
¶
Overview ¶
Package items holds the cross-source items ledger's types.
Index ¶
Constants ¶
const ( MaxSummary = 300 MaxContext = 4000 MaxTrail = 20 )
Limits of an item's text and lists.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Basis ¶
type Basis string // "explicit_mention", "dm_addressee", "reply_context", "self_assigned", "reassigned", "group_ask", "none"
type Confidence ¶
type Confidence string // "high", "low"
const ( High Confidence = "high" Low Confidence = "low" )
type Evidence ¶
type Evidence struct {
Kind EvidenceKind `json:"kind"`
Anchor unit.Anchor `json:"anchor"`
}
type EvidenceKind ¶
type EvidenceKind string
EvidenceKind is what an item's evidence is: one of the core's kinds below, or one its plugin declares, spelled as a name (lower case letters, digits and underscores, starting with a letter).
const ( EvidenceMessage EvidenceKind = "message" EvidenceReaction EvidenceKind = "reaction" EvidenceExternalClaim EvidenceKind = "external_claim" EvidenceUnitEvent EvidenceKind = "unit_event" EvidenceSentDraft EvidenceKind = "sent_draft" )
type Fields ¶
type Fields struct {
Kind *Kind `json:"kind,omitempty"`
Summary *string `json:"summary,omitempty"`
Context *string `json:"context,omitempty"`
Deadline *string `json:"deadline,omitempty"`
Ambiguity *string `json:"ambiguity,omitempty"`
Options *[]Option `json:"options,omitempty"`
URLs *[]string `json:"urls,omitempty"`
Contexts *[]string `json:"contexts,omitempty"`
Initial *Initial `json:"initial,omitempty"`
Requester *Person `json:"requester,omitempty"`
WaitingOn *[]Person `json:"waiting_on,omitempty"`
Confidence *Confidence `json:"confidence,omitempty"`
}
Fields: nil means unchanged; create needs Kind and Summary.
type Identity ¶
type Identity struct {
Keys []string
Codecs unit.KeyComparer `json:"-"`
}
Identity is the user's keys over the enabled plugins: each Identity's Key and Aliases, so an email:<addr> alias matches across plugins. Codecs compare two keys of one provider; nil compares them byte for byte.
type Initial ¶
type Initial string
Initial is the category a plugin proposes an item's new task starts in, never a state name: the task takes the profile's first state of it. "" leaves it to the rules.
type Item ¶
type Item struct {
ID string `json:"id"` // stable per unit: derived ids from the plugin's rule ("gh:review"), turn creates "t<hash8>.<i>", others "i<N>"
Unit unit.Unit `json:"unit"`
Kind Kind `json:"kind"`
Summary string `json:"summary"` // <= 300
Context string `json:"context"` // <= 4000
Options []Option `json:"options,omitempty"`
Deadline string `json:"deadline,omitempty"`
URLs []string `json:"urls,omitempty"`
Contexts []string `json:"contexts,omitempty"` // proposed contexts ("@decide", "@repo-api"); tasks copy them, the user edits there
Initial Initial `json:"initial,omitempty"` // proposed category of a new task
Origin unit.Anchor `json:"origin"`
Requester Person `json:"requester"`
Assignees []Person `json:"assignees,omitempty"`
AssignedAt unit.Anchor `json:"assigned_at,omitzero"`
Basis Basis `json:"basis"`
WaitingOn []Person `json:"waiting_on,omitempty"`
State State `json:"state"`
Resolution Resolution `json:"resolution,omitempty"`
Evidence Evidence `json:"evidence,omitzero"`
Trail []Evidence `json:"trail,omitempty"` // evidence ops, oldest first, at most 20 kept
Confidence Confidence `json:"confidence"`
Ambiguity string `json:"ambiguity,omitempty"`
Provenance Provenance `json:"provenance"` // of the op that created it
Confirmed bool `json:"confirmed"`
// TaskKey groups a unit's items into one task: the item id when empty. A plugin sets the unit's own key to
// make every item of the unit an ask of the unit's one task.
TaskKey string `json:"task_key,omitempty"`
UserAt time.Time `json:"user_at,omitzero"` // time of the last applied user op
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type Op ¶
type Op struct {
Op OpKind `json:"op"`
Unit unit.Unit `json:"unit,omitzero"` // a turn's ops default to the turn's unit
Item string `json:"item,omitempty"` // required but on create; a create may name its id
Anchor unit.Anchor `json:"anchor"` // required; Anchor.Unit defaults to Unit
Fields *Fields `json:"fields,omitempty"` // create, update
Assignees []Person `json:"assignees,omitempty"` // assign
Basis Basis `json:"basis,omitempty"` // assign
Resolution Resolution `json:"resolution,omitempty"` // resolve
Evidence *Evidence `json:"evidence,omitempty"` // resolve (nil means {message, Anchor}); evidence: required
To *unit.Unit `json:"to,omitempty"` // link
LinkKind link.Kind `json:"link_kind,omitempty"` // link
Reason string `json:"reason,omitempty"`
}
Op is the only way the ledger changes; it is also the wire form of turn_end's "ledger".
func (Op) ValidateShape ¶
ValidateShape names the refusals per field, as record.Problems does.
type OpKind ¶
type OpKind string // "create", "update", "assign", "resolve", "reopen", "link", "evidence"
type Person ¶
type Person struct {
// Key is "<provider>:<id>" ("github:octocat", "slack:U000AAA"), "group:<name>" for a group
// or role, or "system:<brand.Name>" for the loop itself (the requester of loop proposals).
Key string `json:"key"`
Name string `json:"name"`
Aliases []string `json:"aliases,omitempty"` // other keys of the same human
}
type Problems ¶
type Problems []string
Problems are the refusals of an op, one "<field>: <why>" each.
type Provenance ¶
type Provenance string // "extracted", "derived", "user", "turn", "effects" (the outbox, recording what it sent)
const ( Extracted Provenance = "extracted" Derived Provenance = "derived" User Provenance = "user" Turn Provenance = "turn" Effects Provenance = "effects" )
type Resolution ¶
type Resolution string // "", "done", "answered", "fixed", "delegated", "declined", "dismissed", "superseded", "moot"
const ( Done Resolution = "done" Answered Resolution = "answered" Fixed Resolution = "fixed" Delegated Resolution = "delegated" Declined Resolution = "declined" Dismissed Resolution = "dismissed" Superseded Resolution = "superseded" Moot Resolution = "moot" )