Documentation
¶
Overview ¶
Package core holds momo's view of a conversation: the messages channels deliver and the action each direction leads to.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TextOf ¶
func TextOf(content []ContentBlock) string
TextOf is the inverse of Text: the text blocks carry, joined, and nothing of the base64 payload an image, audio or blob block holds. A channel that speaks plain text converts with it at its own edge.
Types ¶
type ContentBlock ¶
type ContentBlock struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
Data string `json:"data,omitempty"`
MimeType string `json:"mimeType,omitempty"`
URI string `json:"uri,omitempty"`
Name string `json:"name,omitempty"`
Resource *Resource `json:"resource,omitempty"`
}
ContentBlock is one block of a message's content, in ACP v1's shape: a message arriving as ACP reaches the core unchanged and is forwardable to an agent harness as it was sent. Only the fields v1 requires are modelled. Channels that do not speak ACP convert at their own edge.
func Text ¶
func Text(s string) []ContentBlock
Text is a text content block, the shape a channel with plain text messages converts into.
type EchoHandler ¶
EchoHandler answers every incoming message with the content it carried.
ponytail: this is the proof that the reply path works end to end, nothing more; the agent harness replaces it.
type Handler ¶
type Handler interface {
Received(ctx context.Context, m Message, reply Reply)
Sent(ctx context.Context, m Message)
}
Handler is what a channel delivers messages to. The two directions are separate methods because each is an occasion for a different action, and only the incoming one has something to answer.
type Message ¶
type Message struct {
Contact string
Content []ContentBlock
}
Message is a message exchanged with a contact, in the shape the core acts on.