message

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: 4 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 message holds the Inbox messages: questions, agent posts and proposals.

Index

Constants

View Source
const (
	OriginTurn     = "turn"
	OriginAgent    = "agent"
	OriginLedger   = "ledger"
	OriginCore     = "core"
	OriginWorkflow = "workflow"
)

The kinds of an Origin.

View Source
const TextMax = 4000

TextMax bounds a message's text in bytes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind string // question (end of turn), agent_post (inbox_post), proposal (ledger proposals, workflow decisions; never for a draft)
const (
	Question  Kind = "question"
	AgentPost Kind = "agent_post"
	Proposal  Kind = "proposal"
)

type Message

type Message struct {
	ID        int64
	EntryID   string    // its Inbox entry, opened through gtd.Service.Open
	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
	Origin    Origin
	State     State
	Answer    string // the answer as stored, one line

	CreatedAt, ClosedAt time.Time
}

type Origin

type Origin struct {
	Kind     string // turn, agent, ledger, core, workflow
	TurnSeq  int64  // 0 when no turn
	Session  string
	Workflow string // workflow or core rule name
	Proposal int64  // Kind ledger: the items.Proposal id
}

type State

type State string // open, answered, dismissed, superseded
const (
	Open       State = "open"
	Answered   State = "answered"
	Dismissed  State = "dismissed"
	Superseded State = "superseded"
)

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)
	ByEntry(ctx context.Context, entry string) (Message, bool, error)
	Open(ctx context.Context) ([]Message, error)
	Close(ctx context.Context, id int64, st State, answer string, at time.Time) error
}

Jump to

Keyboard shortcuts

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