Documentation
¶
Overview ¶
Package messages keeps the Inbox messages: questions of turns, agent posts and proposals that ask a decision.
Index ¶
- Constants
- Variables
- type Answer
- type Books
- type Capped
- type Entries
- type Intents
- type Ledger
- type PostRequest
- type ProposeRequest
- type Service
- func (s *Service) Answer(ctx context.Context, id int64, a Answer) (turns.AnswerResult, error)
- func (s *Service) Dismiss(ctx context.Context, id int64) error
- func (s *Service) Post(ctx context.Context, p PostRequest) (message.Message, error)
- func (s *Service) Propose(ctx context.Context, p ProposeRequest) (message.Message, error)
- func (s *Service) Reconcile(ctx context.Context, units ...unit.Unit) error
- func (s *Service) ReconcileProposals(ctx context.Context) error
- func (s *Service) Run(ctx context.Context, changes port.Changes)
- type Turns
Constants ¶
const ( OptionAccept = "accept" OptionReject = "reject" )
The options of a ledger proposal's message.
const PostsPerTurn = 3
PostsPerTurn is how many agent posts of one turn may be open at once.
Variables ¶
var ( ErrNoMessage = errors.New("no such message") // ErrClosed is an answer or a dismiss of a message that is no longer open. ErrClosed = errors.New("the message is closed") // ErrNoStartedTurn refuses inbox_post from a session with no started turn. ErrNoStartedTurn = errors.New("this session has no started turn") )
Functions ¶
This section is empty.
Types ¶
type Books ¶
type Books interface {
Books(ctx context.Context, units ...unit.Unit) (map[unit.Unit]turn.Book, error)
BookOf(ctx context.Context, k turns.Key) (turn.Book, bool, error)
}
Books reads the turn books, as turns.Store does.
type Entries ¶
type Entries interface {
Open(ctx context.Context, r coregtd.OpenRequest) (gtd.Entry, error)
Close(ctx context.Context, id gtd.ID, to gtd.State) error
Entry(ctx context.Context, id gtd.ID) (gtd.Entry, error)
Retitle(ctx context.Context, id gtd.ID, title string) error
}
Entries opens and closes the Inbox entry of each message, as gtd.Service does.
type Intents ¶
type Intents interface{ Answerable() []string }
Intents names the intents whose questions an answer addresses.
type Ledger ¶
type Ledger interface {
Proposals(ctx context.Context, state coreitems.ProposalState) ([]coreitems.Proposal, error)
Decide(ctx context.Context, id int64, accept bool) (coreitems.Result, error)
}
Ledger is the items ledger's proposals.
type PostRequest ¶
type ProposeRequest ¶
type Service ¶
type Service struct {
Store message.Store
Books Books
Turns Turns
Ledger Ledger // nil: no proposal messages
Entries Entries
Intents Intents
Clock port.Clock
Log func(format string, args ...any)
// OnAnswer runs when a core or workflow proposal is answered, before it closes; nil only closes it.
OnAnswer func(ctx context.Context, m message.Message, a Answer) error
// contains filtered or unexported fields
}
func (*Service) Answer ¶
Answer answers an open message: a question through turns.Service.Answer unchanged, an agent post into the session that posted it, a proposal by deciding it.
func (*Service) Dismiss ¶
Dismiss closes a message without an answer: a question's turn is dismissed as turns.Service.Dismiss does, a ledger proposal is rejected.
func (*Service) Post ¶
Post is inbox_post: an open agent_post message on the unit of the session's started turn.
func (*Service) Propose ¶
Propose opens a proposal message of a workflow or core rule, one per unit and rule while it is open; with EntryID it attaches to that entry instead of opening one.
func (*Service) Reconcile ¶
Reconcile makes the open question messages match the books: one per turn whose newest record is asked or that stopped waiting on the user; others closed. With no units it reconciles every book.
func (*Service) ReconcileProposals ¶
ReconcileProposals makes one open proposal message per open items.Proposal; closed when it is decided.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package messagestest holds an in-memory message store and the contract every message store meets.
|
Package messagestest holds an in-memory message store and the contract every message store meets. |