Documentation
¶
Overview ¶
Package events defines the shared rocketclaw event bus.
Index ¶
- Constants
- Variables
- func AttachmentNamesSpeech(attachments []OutboundAttachment) string
- func IsTextAttachment(name, mimeType string) bool
- func SetInboundAllowedAgents(inbound *InboundMessage, agents []string)
- func StartNewThreadRootText(title, prompt string) string
- type AskUserQuestionAnswer
- type AskUserQuestionOption
- type AskUserQuestionRequest
- type Bus
- type ExternalMCPRelay
- type InboundAttachment
- type InboundContent
- type InboundKind
- type InboundMessage
- type InboundResponse
- type OutboundAttachment
- type OutboundMessage
- type OutputTarget
- type SlackReplyTarget
- type Source
- type StartNewThreadRequest
- type StartNewThreadResult
- type StartNewThreadRootResult
- type TextConversationTarget
Constants ¶
const ( // InboundOriginMetadataKey overrides the trusted prompt provenance origin. InboundOriginMetadataKey = "rocketclaw_origin" // InboundMediaMetadataKey overrides the trusted prompt provenance media. InboundMediaMetadataKey = "rocketclaw_media" // InboundPrincipalMetadataKey identifies the trusted human principal for prompt provenance. InboundPrincipalMetadataKey = "rocketclaw_principal" // InboundAllowedAgentsMetadataKey lists source-surface allowed agents for model-created child conversations. InboundAllowedAgentsMetadataKey = "rocketclaw_allowed_agents" // InboundStartNewThreadDisabledMetadataKey suppresses model-created child conversation tooling for this turn. InboundStartNewThreadDisabledMetadataKey = "rocketclaw_start_new_thread_disabled" )
const MaxInboundTextAttachmentBytes = 256 << 10
MaxInboundTextAttachmentBytes is the per-file size limit for attachments converted to prompt text.
Variables ¶
var ErrBusClosed = errors.New("bus closed")
ErrBusClosed reports that an event was published after the bus shut down.
Functions ¶
func AttachmentNamesSpeech ¶
func AttachmentNamesSpeech(attachments []OutboundAttachment) string
AttachmentNamesSpeech returns a short spoken description of attachment names.
func IsTextAttachment ¶ added in v0.0.7
IsTextAttachment reports whether an attachment should be included as literal prompt text.
func SetInboundAllowedAgents ¶ added in v0.0.16
func SetInboundAllowedAgents(inbound *InboundMessage, agents []string)
SetInboundAllowedAgents records surface-constrained agents on an inbound message.
func StartNewThreadRootText ¶ added in v0.0.16
StartNewThreadRootText returns the human-visible root text for tool-created text conversations.
Types ¶
type AskUserQuestionAnswer ¶ added in v0.0.12
type AskUserQuestionAnswer struct {
Selected []string `json:"selected"`
Custom string `json:"custom"`
Source Source `json:"source"`
}
AskUserQuestionAnswer is returned to RocketCode after a human answers.
type AskUserQuestionOption ¶ added in v0.0.12
type AskUserQuestionOption struct{ Label, Value, Description string }
AskUserQuestionOption is one native UI choice for ask_user_question.
type AskUserQuestionRequest ¶ added in v0.0.12
type AskUserQuestionRequest struct {
Source Source
ID, Question, Details string
ConversationID string
Options []AskUserQuestionOption
Multiple bool
SlackReply *SlackReplyTarget
}
AskUserQuestionRequest asks the originating text connector human for input.
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus routes outbound text events between components.
func (*Bus) PublishOutbound ¶
func (b *Bus) PublishOutbound(ctx context.Context, msg *OutboundMessage) error
PublishOutbound publishes a text message to all output sinks.
type ExternalMCPRelay ¶ added in v0.0.33
type ExternalMCPRelay struct {
ExternalConversationID, Agent, Text string
Attachments []OutboundAttachment
}
ExternalMCPRelay carries one MCP request to its Slack surface.
type InboundAttachment ¶
InboundAttachment carries an inline attachment into a conversation prompt.
type InboundContent ¶ added in v0.0.7
type InboundContent struct {
Text string
TextAttachments []string
Attachments []InboundAttachment
HadAttachments bool
HadNonImageAttachments bool
AttachmentWarnings []string
}
InboundContent carries source-acquired inbound text and attachments before message routing details are applied.
type InboundKind ¶
type InboundKind string
InboundKind describes how an inbound message should be handled.
const ( // InboundKindPrompt is a normal conversational prompt. InboundKindPrompt InboundKind = "prompt" // InboundKindInternalize is a note the session should absorb without replying. InboundKindInternalize InboundKind = "internalize" )
type InboundMessage ¶
type InboundMessage struct {
Source Source
Label, Text string
VerbatimMessage string
VerbatimAttachments []OutboundAttachment
Attachments []InboundAttachment
SlackReply *SlackReplyTarget
HadAttachments, HadNonImageAttachments, Human, GoalTurn bool
AttachmentWarnings []string
Kind InboundKind
ConversationID string
Metadata map[string]string
// contains filtered or unexported fields
}
InboundMessage is a message headed into its conversation prompt queue.
func NewInboundMessage ¶ added in v0.0.33
func NewInboundMessage(source Source, kind InboundKind, label, text string, human bool) *InboundMessage
NewInboundMessage constructs an unrouted inbound message.
func NewInboundMessageFromContent ¶ added in v0.0.33
func NewInboundMessageFromContent(source Source, kind InboundKind, label string, content *InboundContent, human bool) *InboundMessage
NewInboundMessageFromContent constructs an unrouted inbound message from normalized source content.
func (*InboundMessage) CompleteResponse ¶
func (m *InboundMessage) CompleteResponse(text string, err error)
CompleteResponse marks this inbound turn result ready.
func (*InboundMessage) CompleteResponseWithAttachments ¶ added in v0.0.7
func (m *InboundMessage) CompleteResponseWithAttachments(text string, attachments []OutboundAttachment, err error)
CompleteResponseWithAttachments marks this inbound turn result ready with response attachments.
func (*InboundMessage) EnableResponseWait ¶
func (m *InboundMessage) EnableResponseWait() <-chan InboundResponse
EnableResponseWait returns a channel that receives the final result for this inbound turn.
type InboundResponse ¶
type InboundResponse struct {
Text string
Attachments []OutboundAttachment
Err error
}
InboundResponse is the final plain-text result for a queued inbound turn.
type OutboundAttachment ¶
OutboundAttachment carries a human-visible file attachment to output sinks.
func CloneOutboundAttachments ¶
func CloneOutboundAttachments(attachments []OutboundAttachment) []OutboundAttachment
CloneOutboundAttachments returns a deep copy of attachments.
type OutboundMessage ¶
type OutboundMessage struct {
Text, ProgressText string
Source Source
Targets []OutputTarget
ConversationID, TurnID string
ExternalConversationID string
Agent string
Sequence int
PostProgressText, Complete bool
SlackReply *SlackReplyTarget
Attachments []OutboundAttachment
GoalTurn, GoalComplete bool
GoalTurnNumber, GoalMaxTurns int
// contains filtered or unexported fields
}
OutboundMessage is a text message headed to enabled connectors.
func NewOutboundMessage ¶ added in v0.0.33
func NewOutboundMessage(source Source, conversationID, text string, targets ...OutputTarget) *OutboundMessage
NewOutboundMessage constructs an outbound message for one explicit conversation.
func (*OutboundMessage) MarkDelivered ¶
func (m *OutboundMessage) MarkDelivered(err error)
MarkDelivered marks outbound delivery for this message complete.
func (*OutboundMessage) WaitDelivered ¶
func (m *OutboundMessage) WaitDelivered(ctx context.Context) error
WaitDelivered waits until outbound delivery for this message finishes.
type OutputTarget ¶
type OutputTarget string
OutputTarget identifies which connector should receive an outbound message.
const ( // OutputTargetSlack delivers a response to its explicit Slack thread. OutputTargetSlack OutputTarget = "slack" )
type SlackReplyTarget ¶
type SlackReplyTarget struct {
ChannelID, MessageTS, ThreadTS string
RecipientTeamID, RecipientUserID string
}
SlackReplyTarget identifies the Slack message that owns a streamed reply.
type StartNewThreadRequest ¶ added in v0.0.16
type StartNewThreadRequest struct {
Source Source
SourceConversationID, CurrentAgent, Agent, Title, Prompt string
AllowedAgents []string
SlackReply *SlackReplyTarget
}
StartNewThreadRequest asks RocketClaw to create a new managed conversation from the current turn.
type StartNewThreadResult ¶ added in v0.0.16
type StartNewThreadResult struct {
ConversationID string `json:"conversation_id"`
URL string `json:"url,omitempty"`
}
StartNewThreadResult reports the created conversation and openable surface.
type StartNewThreadRootResult ¶ added in v0.0.16
type StartNewThreadRootResult struct {
Target TextConversationTarget
URL string
}
StartNewThreadRootResult reports the native root surface created by a text connector.
type TextConversationTarget ¶ added in v0.0.7
type TextConversationTarget struct{ ChannelID, MessageID, ThreadID string }
TextConversationTarget identifies a conversation/message in the configured primary text connector.