Documentation
¶
Index ¶
- Constants
- func BuildConvertedEdit(content *event.MessageEventContent, topLevelExtra map[string]any) *bridgev2.ConvertedEdit
- func BuildRenderedConvertedEdit(rendered RenderedMarkdownContent, topLevelExtra map[string]any) *bridgev2.ConvertedEdit
- func EmitStreamEvent(ctx context.Context, portal *bridgev2.Portal, state StreamEventState, ...)
- func EmitStreamEventWithSession(ctx context.Context, portal *bridgev2.Portal, turnID string, suppressSend bool, ...)
- func EnsureDontRenderEdited(edit *bridgev2.ConvertedEdit)
- func ShouldFallbackToDebounced(err error) bool
- func SplitAtMarkdownBoundary(text string, maxBytes int) (string, string)
- type DebouncedEditContent
- type DebouncedEditParams
- type EndReason
- type RenderedMarkdownContent
- type StreamEventState
- type StreamSession
- type StreamSessionParams
Constants ¶
const MaxMatrixEventBodyBytes = 60000
Variables ¶
This section is empty.
Functions ¶
func BuildConvertedEdit ¶
func BuildConvertedEdit(content *event.MessageEventContent, topLevelExtra map[string]any) *bridgev2.ConvertedEdit
BuildConvertedEdit wraps rendered message content into a standard Matrix edit. The bridge layer will derive the Matrix edit fallback fields from Content via SetEdit, so TopLevelExtra should only contain custom top-level fields.
func BuildRenderedConvertedEdit ¶
func BuildRenderedConvertedEdit(rendered RenderedMarkdownContent, topLevelExtra map[string]any) *bridgev2.ConvertedEdit
func EmitStreamEvent ¶
func EmitStreamEvent(ctx context.Context, portal *bridgev2.Portal, state StreamEventState, part map[string]any)
EmitStreamEvent logs the stream start once and emits a part through a session.
func EmitStreamEventWithSession ¶
func EmitStreamEventWithSession( ctx context.Context, portal *bridgev2.Portal, turnID string, suppressSend bool, loggedStart *bool, logger *zerolog.Logger, ensureSession func() *StreamSession, part map[string]any, )
EmitStreamEventWithSession is a convenience wrapper for callers that only need to provide the common stream state fields.
func EnsureDontRenderEdited ¶
func EnsureDontRenderEdited(edit *bridgev2.ConvertedEdit)
EnsureDontRenderEdited marks every edit part so clients can suppress "edited" UI chrome.
func ShouldFallbackToDebounced ¶
ShouldFallbackToDebounced returns true when an ephemeral stream send failure looks like server/client unsupported behavior (unknown/unrecognized/etc).
Types ¶
type DebouncedEditContent ¶
DebouncedEditContent is the rendered content for a debounced streaming edit.
func BuildDebouncedEditContent ¶
func BuildDebouncedEditContent(p DebouncedEditParams) *DebouncedEditContent
BuildDebouncedEditContent validates inputs and renders the edit content. Returns nil if the edit should be skipped.
type DebouncedEditParams ¶
type DebouncedEditParams struct {
PortalMXID string
Force bool
SuppressSend bool
VisibleBody string
FallbackBody string
}
DebouncedEditParams holds the inputs needed by BuildDebouncedEditContent.
type RenderedMarkdownContent ¶
type StreamEventState ¶
type StreamSession ¶
type StreamSession struct {
// contains filtered or unexported fields
}
func NewStreamSession ¶
func NewStreamSession(params StreamSessionParams) *StreamSession
func (*StreamSession) EmitPart ¶
func (s *StreamSession) EmitPart(ctx context.Context, part map[string]any)
func (*StreamSession) IsClosed ¶
func (s *StreamSession) IsClosed() bool
type StreamSessionParams ¶
type StreamSessionParams struct {
TurnID string
AgentID string
GetTargetEventID func() string
GetRoomID func() id.RoomID
GetSuppressSend func() bool
NextSeq func() int
RuntimeFallbackFlag *atomic.Bool
GetEphemeralSender func(ctx context.Context) (bridgev2.EphemeralSendingMatrixAPI, bool)
SendDebouncedEdit func(ctx context.Context, force bool) error
ClearTurnGate func()
SendHook func(turnID string, seq int, content map[string]any, txnID string) bool
Logger *zerolog.Logger
}