Documentation
¶
Overview ¶
Package message holds the subjects of the question, post and proposal gates: a turn's question, an agent's post, a proposal. The gate holds the decision; a message keeps what was asked and the answer as stored.
Index ¶
Constants ¶
const ( OriginTurn = "turn" OriginAgent = "agent" OriginLedger = "ledger" OriginCore = "core" OriginWorkflow = "workflow" )
The kinds of an Origin.
const TextMax = 4000
TextMax bounds a message's text in bytes.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conversation ¶ added in v0.3.0
Conversation is an Inbox message and the user's answers to it, oldest first. Message is zero for the answers of a turn stored before each answer named its message.
type Kind ¶
type Kind string // question (end of turn), agent_post (task_post), proposal (ledger proposals, workflow decisions; never for a draft)
type Message ¶
type Message struct {
ID int64
TaskID string // the task its gate is on
Unit unit.Unit // zero for a message on no unit
Kind Kind
Text string // <= 4000 bytes, no control characters
Options []record.Option
Recommend string
Confirm bool // a yes/no question
// Draft is the held draft a confirm's yes approves, at the rev the question pinned; nil for none.
Draft *record.DraftRef
Origin Origin
Answer string // the answer as stored, one line
// ClosedAt is when its gate closed, zero while it is open.
CreatedAt, ClosedAt time.Time
}
type Store ¶
type Store interface {
// Upsert keys a question by (Unit, Origin.Kind, Origin.TurnSeq), a ledger proposal by Origin.Proposal,
// a workflow or core proposal by (Unit, Origin.Workflow) while open.
Upsert(ctx context.Context, m Message) (Message, error)
Message(ctx context.Context, id int64) (Message, bool, error)
Open(ctx context.Context) ([]Message, error)
// Close closes an open message with answer at at; on one closed with an answer, a new answer rewords it.
Close(ctx context.Context, id int64, answer string, at time.Time) error
}