items

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: 7 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 items holds the cross-source items ledger's types.

Index

Constants

View Source
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"
const (
	ExplicitMention Basis = "explicit_mention"
	DMAddressee     Basis = "dm_addressee"
	ReplyContext    Basis = "reply_context"
	SelfAssigned    Basis = "self_assigned"
	Reassigned      Basis = "reassigned"
	GroupAsk        Basis = "group_ask"
	NoBasis         Basis = "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 // "message", "reaction", "external_claim", "unit_event", "sent_draft"
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 // "", "inbox", "next": the plugin's proposed first GTD state; "" is inbox
const (
	InitialInbox Initial = "inbox"
	InitialNext  Initial = "next"
)

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 GTD contexts ("@decide", "@repo-api"); entries copy them, the user edits there
	Initial    Initial     `json:"initial,omitempty"`  // proposed first GTD state, honored for a new entry
	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"`
	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 Kind

type Kind string // "request", "question", "decision", "todo"
const (
	Request  Kind = "request"
	Question Kind = "question"
	Decision Kind = "decision"
	Todo     Kind = "todo"
)

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

func (o Op) ValidateShape() error

ValidateShape names the refusals per field, as record.Problems does.

type OpKind

type OpKind string // "create", "update", "assign", "resolve", "reopen", "link", "evidence"
const (
	OpCreate   OpKind = "create"
	OpUpdate   OpKind = "update"
	OpAssign   OpKind = "assign"
	OpResolve  OpKind = "resolve"
	OpReopen   OpKind = "reopen"
	OpLink     OpKind = "link"
	OpEvidence OpKind = "evidence"
)

type Option

type Option struct {
	Label    string   `json:"label"`
	ArguedBy []Person `json:"argued_by,omitempty"`
}

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
}

func (Person) Is

func (p Person) Is(id Identity) bool

Is says whether p's Key or an alias is in id.Keys, keys of one provider compared through that provider's codec.

type Problems

type Problems []string

Problems are the refusals of an op, one "<field>: <why>" each.

func (Problems) Error

func (p Problems) Error() string

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"
)

type State

type State string // "open", "resolved"
const (
	Open     State = "open"
	Resolved State = "resolved"
)

Jump to

Keyboard shortcuts

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