Documentation
¶
Overview ¶
Package common holds shared platform helpers for inbound routing, slash commands, and outbound delivery.
Index ¶
- Constants
- Variables
- func AllowList(allowFrom, userID string) bool
- func ApplyInteractionPolicy(e *interaction.Event, value any)
- func CardActionCommand(action string) (string, bool)
- func CardControlValues(control map[string]any) []any
- func CardRoute(ctx context.Context, route agentkit.RouteRef, card *Card, ...) (agentkit.RouteRef, agentkit.SessionRouteTarget, error)
- func EnrichInteractionCard(e *interaction.Event)
- func FormatAskUserPrompt(question string, options []string) string
- func FormatCardActionInbound(cardText string, fetchedCard bool, operationBody string, userID string) string
- func FormatHelp(ctx context.Context, commands agentkit.Commands) string
- func FormatInteraction(e interaction.Event) string
- func FormatPermissionRequest(payload permission.RequestPayload) string
- func FormatUnknownCommand(name string) string
- func InboundFromContent(agentID agentkit.AgentID, route agentkit.SessionRouteInput, ...) agentkit.MessageEvent
- func InboundMessage(agentID agentkit.AgentID, sessionID agentkit.SessionID, ...) agentkit.MessageEvent
- func InteractionControlForm(raw json.RawMessage, control string) (bool, string)
- func InteractionControlInForm(raw json.RawMessage, control string) bool
- func InteractionDedupKey(parts ...string) string
- func InteractionEventKey(e interaction.Event) string
- func InteractionMetadata(ctx context.Context, load func(context.Context) map[string]any) map[string]any
- func InteractionSubmissionSummary(e interaction.Event) string
- func IsImageAttachment(mimeType, filename string) bool
- func IsOldMessage(msgTime time.Time) bool
- func IsSlashCommand(text string) bool
- func MarkdownToSlackMrkdwn(md string) string
- func MentionProfilesMetadata(profiles []MentionProfile) map[string]any
- func MergeMetadata(base, extra map[string]any) map[string]any
- func ModelMessageText(msg agentkit.ModelMessage) string
- func NormalizeSlackAPIURL(raw string) (string, error)
- func NormalizeUnknownInteraction(mode string) string
- func ParseCardSubmissionTTL(value string) (time.Duration, error)
- func ParsePermissionCallback(data string) (requestID string, index int, ok bool)
- func ParseSlashCommand(line string) (name, args string, ok bool)
- func PermissionActionValue(index int) string
- func PermissionCallbackData(requestID string, index int) string
- func PermissionConversationFromExtra(extra map[string]string) string
- func PermissionDecisionValue(decision string) string
- func PermissionReplyEvent(agentID agentkit.AgentID, sessionID agentkit.SessionID, ...) agentkit.MessageEvent
- func PermissionReplyEventWithConversation(agentID agentkit.AgentID, sessionID agentkit.SessionID, ...) agentkit.MessageEvent
- func PermissionReplyFromAction(actionVal, userID string, extra map[string]string) (permission.Reply, bool)
- func PrepareInboundAttachments(ctx context.Context, ws cw.Service, event agentkit.MessageEvent) (agentkit.MessageEvent, error)
- func ProcessInteraction(ctx context.Context, e interaction.Event, p InteractionProcessing) error
- func ProcessInteractionCommand(ctx context.Context, e interaction.Event, c InteractionCommand) bool
- func ReadMediaPart(part agentkit.ContentPart) (data []byte, fileName string, err error)
- func RedactToken(text, token string) string
- func ReleaseInboundUploads(event agentkit.MessageEvent)
- func ResolveDomain(raw, defaultDomain string) (string, error)
- func SlashCommandContext(ctx context.Context, commands agentkit.Commands, slash SlashContext) context.Context
- func StageInboundUploads(event agentkit.MessageEvent) (agentkit.MessageEvent, error)
- func SubmittedInteractionText(e interaction.Event) string
- func UserProfileMetadata(name, email string) map[string]any
- func WarnAllowFromEmpty(platform, allowFrom string)
- func WithMetadata(event agentkit.MessageEvent, metadata map[string]any) agentkit.MessageEvent
- type AgentRoutingConfig
- type AudioAttachment
- type Card
- type CardActionLayout
- type CardActions
- type CardBuilder
- type CardButton
- type CardCheckbox
- type CardDivider
- type CardElement
- type CardForm
- type CardHeader
- type CardListItem
- type CardMarkdown
- type CardNote
- type CardSelect
- type CardSelectOption
- type CardSubmissions
- type ChatMessage
- type FileAttachment
- type ImageAttachment
- type InboundOpts
- type Inbox
- type InstanceIdentity
- type InteractionCommand
- type InteractionDedup
- type InteractionOptions
- func (s *InteractionOptions) Clear(sessionID agentkit.SessionID)
- func (s *InteractionOptions) Reply(sessionID agentkit.SessionID, requestID, userID string, index int) (permission.Reply, bool)
- func (s *InteractionOptions) Set(sessionID agentkit.SessionID, requestID string, replies []permission.Reply)
- type InteractionProcessing
- type KeyedExecutor
- type MediaSender
- type MentionProfile
- type MessageDedup
- type Outbound
- type PresavedAttachment
- type SlashContext
- type SlashOutcome
- type SlashOutcomeKind
- type TextSender
Constants ¶
const ( CardActionLayoutRow = delivery.CardActionLayoutRow CardActionLayoutEqualColumns = delivery.CardActionLayoutEqualColumns )
const ( UnknownInteractionForward = "forward" UnknownInteractionIgnore = "ignore" )
const DefaultCardSubmissionTTL = 24 * time.Hour
Variables ¶
var ( ErrExecutorFull = errors.New("platform ingress queue is full") ErrExecutorStopped = errors.New("platform ingress executor stopped") )
var ProcessStartTime = time.Now()
ProcessStartTime is set once at process startup. Platforms discard messages created before this time to avoid replay after restart.
Functions ¶
func AllowList ¶
AllowList returns true when userID is permitted by comma-separated allow_from. Empty or "*" means allow all.
func ApplyInteractionPolicy ¶ added in v0.4.28
func ApplyInteractionPolicy(e *interaction.Event, value any)
ApplyInteractionPolicy reads optional author-supplied metadata. Adapters set safe native defaults first. Slack values can encode this object as JSON text.
func CardActionCommand ¶ added in v0.4.27
CardActionCommand returns only explicit platform command/navigation tokens.
func CardControlValues ¶ added in v0.4.30
CardControlValues returns native callback payloads from legacy value fields and Feishu 2.0 callback behaviors. URL behaviors have no answer payload.
func CardRoute ¶ added in v0.4.44
func CardRoute(ctx context.Context, route agentkit.RouteRef, card *Card, protocol, instance string) (agentkit.RouteRef, agentkit.SessionRouteTarget, error)
CardRoute resolves a background target without per-turn state or caches.
func EnrichInteractionCard ¶ added in v0.4.27
func EnrichInteractionCard(e *interaction.Event)
EnrichInteractionCard supports nested Feishu card JSON and Slack Block Kit. Option values are scoped to their control; ambiguous mappings stay raw.
func FormatAskUserPrompt ¶
FormatAskUserPrompt formats ask_user question and numbered options for display.
func FormatCardActionInbound ¶ added in v0.3.41
func FormatCardActionInbound(cardText string, fetchedCard bool, operationBody string, userID string) string
FormatCardActionInbound builds agent-visible text for unrecognized IM card/block callbacks.
func FormatHelp ¶
FormatHelp renders a plain-text command list for IM platforms.
func FormatInteraction ¶ added in v0.4.27
func FormatInteraction(e interaction.Event) string
FormatInteraction includes the complete structured snapshot as well as a readable summary. Raw JSON is data supplied by the card author/user.
func FormatPermissionRequest ¶
func FormatPermissionRequest(payload permission.RequestPayload) string
FormatPermissionRequest formats a permission request as assistant-visible text.
func FormatUnknownCommand ¶
FormatUnknownCommand matches cc-connect's unknown slash forwarding notice.
func InboundFromContent ¶
func InboundFromContent(agentID agentkit.AgentID, route agentkit.SessionRouteInput, userID, content, extraContent string, images []ImageAttachment, files []FileAttachment, audio *AudioAttachment, filePaths []string, opts *InboundOpts) agentkit.MessageEvent
InboundFromContent builds a MessageEvent from text and media. By default it saves attachments eagerly. DeferUploads retains fresh bytes for turn-time materialization; existing file references are pinned to their ingress paths.
func InboundMessage ¶
func InteractionControlForm ¶ added in v0.4.28
func InteractionControlForm(raw json.RawMessage, control string) (bool, string)
InteractionControlForm also returns a native button's form_action_type. Explicit interaction policy remains authoritative over native semantics.
func InteractionControlInForm ¶ added in v0.4.28
func InteractionControlInForm(raw json.RawMessage, control string) bool
InteractionControlInForm recognizes native form/input ancestors.
func InteractionDedupKey ¶ added in v0.3.41
InteractionDedupKey joins segments for short-lived interaction deduplication.
func InteractionEventKey ¶ added in v0.4.27
func InteractionEventKey(e interaction.Event) string
InteractionEventKey excludes callback delivery metadata but covers all actual operation data, including actor, control, selections, input and form state.
func InteractionMetadata ¶ added in v0.4.27
func InteractionMetadata(ctx context.Context, load func(context.Context) map[string]any) map[string]any
InteractionMetadata bounds optional profile enrichment, preserving time for the actual queue operation. Platform loaders must honor the supplied context.
func InteractionSubmissionSummary ¶ added in v0.4.29
func InteractionSubmissionSummary(e interaction.Event) string
InteractionSubmissionSummary excludes the original content already present on the card.
func IsImageAttachment ¶ added in v0.1.12
IsImageAttachment reports whether an inbound attachment should be sent to the model as vision input instead of a read-tool file path.
func IsOldMessage ¶
IsOldMessage returns true if msgTime is before process start (with grace).
func IsSlashCommand ¶
IsSlashCommand reports whether text starts with a slash command.
func MarkdownToSlackMrkdwn ¶
MarkdownToSlackMrkdwn converts standard Markdown to Slack mrkdwn format.
func MentionProfilesMetadata ¶ added in v0.2.10
func MentionProfilesMetadata(profiles []MentionProfile) map[string]any
MentionProfilesMetadata builds inbound mention metadata for runner inject.
func MergeMetadata ¶ added in v0.2.10
MergeMetadata merges extra metadata into base without overwriting existing keys.
func ModelMessageText ¶
func ModelMessageText(msg agentkit.ModelMessage) string
ModelMessageText joins non-empty text parts from a model message.
func NormalizeSlackAPIURL ¶
NormalizeSlackAPIURL returns a slack-go compatible Web API base URL (trailing slash). Bare host URLs are normalized to end with /api/ like cc-connect.
func NormalizeUnknownInteraction ¶ added in v0.3.41
NormalizeUnknownInteraction maps platform config to forward or ignore (default forward).
func ParseCardSubmissionTTL ¶ added in v0.4.28
func ParsePermissionCallback ¶
ParsePermissionCallback decodes Telegram callback_data.
func ParseSlashCommand ¶
ParseSlashCommand splits "/name args" into name and args.
func PermissionActionValue ¶
PermissionActionValue is the short action token stored in card button values.
func PermissionCallbackData ¶
PermissionCallbackData builds Telegram callback_data (perm:<requestID>:<index>).
func PermissionConversationFromExtra ¶ added in v0.2.2
PermissionConversationFromExtra reads the Loop conversation id echoed on card buttons.
func PermissionDecisionValue ¶
PermissionDecisionValue is the action token stored in allow/deny card buttons.
func PermissionReplyEvent ¶
func PermissionReplyEvent(agentID agentkit.AgentID, sessionID agentkit.SessionID, platformID, userID string, reply permission.Reply) agentkit.MessageEvent
func PermissionReplyEventWithConversation ¶ added in v0.2.2
func PermissionReplyEventWithConversation(agentID agentkit.AgentID, sessionID agentkit.SessionID, platformID, userID, conversation string, reply permission.Reply) agentkit.MessageEvent
func PermissionReplyFromAction ¶
func PermissionReplyFromAction(actionVal, userID string, extra map[string]string) (permission.Reply, bool)
PermissionReplyFromAction extracts a typed permission reply from card callback payloads.
func PrepareInboundAttachments ¶ added in v0.4.40
func PrepareInboundAttachments(ctx context.Context, ws cw.Service, event agentkit.MessageEvent) (agentkit.MessageEvent, error)
PrepareInboundAttachments materializes fresh uploads using the caller's fixed turn context. Already-saved references are never moved or reinterpreted. Custom runners must call this after session routing and cwd preparation.
func ProcessInteraction ¶ added in v0.4.27
func ProcessInteraction(ctx context.Context, e interaction.Event, p InteractionProcessing) error
func ProcessInteractionCommand ¶ added in v0.4.27
func ProcessInteractionCommand(ctx context.Context, e interaction.Event, c InteractionCommand) bool
func ReadMediaPart ¶ added in v0.1.6
func ReadMediaPart(part agentkit.ContentPart) (data []byte, fileName string, err error)
ReadMediaPart loads bytes for an outbound image or document content part. tool/send stores the resolved workspace path in URL.
func RedactToken ¶
RedactToken replaces a secret token in text with [REDACTED].
func ReleaseInboundUploads ¶ added in v0.4.40
func ReleaseInboundUploads(event agentkit.MessageEvent)
ReleaseInboundUploads discards only owned transient staging. Final workspace files are separate copies and are never removed. Safe on every terminal path.
func ResolveDomain ¶
ResolveDomain returns trimmed raw when set, otherwise defaultDomain. Empty raw after trim uses defaultDomain without validation.
func SlashCommandContext ¶ added in v0.3.0
func SlashCommandContext(ctx context.Context, commands agentkit.Commands, slash SlashContext) context.Context
SlashCommandContext builds the slash command execution context from routing metadata and optional admin enrichment.
func StageInboundUploads ¶ added in v0.4.40
func StageInboundUploads(event agentkit.MessageEvent) (agentkit.MessageEvent, error)
StageInboundUploads takes ownership of transient uploads and replaces byte payloads with opaque disk sources before queue retention. On failure it releases staging data and bytes; the caller must report the returned error rather than dispatch the event.
func SubmittedInteractionText ¶ added in v0.4.28
func SubmittedInteractionText(e interaction.Event) string
func UserProfileMetadata ¶ added in v0.2.6
UserProfileMetadata builds inbound sender metadata for runner inject. Leaf platforms query user APIs and set displayName/email; chat-api maps caller headers into Metadata instead.
func WarnAllowFromEmpty ¶
func WarnAllowFromEmpty(platform, allowFrom string)
WarnAllowFromEmpty logs when allow_from is unset (permit-all).
func WithMetadata ¶ added in v0.2.6
func WithMetadata(event agentkit.MessageEvent, metadata map[string]any) agentkit.MessageEvent
WithMetadata merges metadata onto an inbound event without overwriting existing keys.
Types ¶
type AgentRoutingConfig ¶
type AgentRoutingConfig struct {
AgentID agentkit.AgentID `json:"agentId"`
// SessionScope mirrors runner.config.sessionScope for platform-local slash
// commands (/new active-session mapping). Empty defaults to channel.
SessionScope string `json:"sessionScope"`
// RunnerSessionScope must match runner.config.sessionScope. Slash commands
// (/agent, /new, /model) resolve active-session and agent binds with this
// scope. When empty, SessionScope is used.
RunnerSessionScope string `json:"runnerSessionScope"`
// DisablePlatformSlash skips platform-local slash dispatch (/help, /new, /stop, …).
// Slash-prefixed user text is enqueued as a normal agent turn instead.
DisablePlatformSlash bool `json:"disablePlatformSlash"`
}
AgentRoutingConfig optionally pins inbound messages to a Loop agent. Empty agentId uses loop.defaultAgent.
func (AgentRoutingConfig) ResolveAgentID ¶
func (c AgentRoutingConfig) ResolveAgentID() agentkit.AgentID
func (AgentRoutingConfig) SlashSessionScope ¶ added in v0.4.19
func (c AgentRoutingConfig) SlashSessionScope() agentkit.SessionScope
SlashSessionScope returns the scope platform slash commands must use for active-session and agent bind resolution. It must match runner.config.sessionScope.
type AudioAttachment ¶
AudioAttachment is an inbound voice message.
type Card ¶
Aliases retain the existing renderer and card-builder API.
func ConfirmedAllowDenyCard ¶ added in v0.1.12
ConfirmedAllowDenyCard updates an allow/deny card after the user decides.
func ConfirmedCardFromReply ¶ added in v0.1.12
func ConfirmedCardFromReply(reply permission.Reply, extra map[string]string) *Card
ConfirmedCardFromReply builds a non-interactive card after the user responds.
func ConfirmedPermissionCard ¶
ConfirmedPermissionCard updates the card after the user picks an option.
func PermissionCardFromPayload ¶
func PermissionCardFromPayload(payload permission.RequestPayload) *Card
PermissionCardFromPayload builds a card from Loop permission/request payload.
type CardActionLayout ¶
type CardActionLayout = delivery.CardActionLayout
Aliases retain the existing renderer and card-builder API.
type CardActions ¶
type CardActions = delivery.CardActions
Aliases retain the existing renderer and card-builder API.
type CardBuilder ¶
type CardBuilder = delivery.CardBuilder
Aliases retain the existing renderer and card-builder API.
func NewCard ¶
func NewCard() *CardBuilder
type CardButton ¶
type CardButton = delivery.CardButton
Aliases retain the existing renderer and card-builder API.
type CardCheckbox ¶ added in v0.4.44
type CardCheckbox = delivery.CardCheckbox
Aliases retain the existing renderer and card-builder API.
type CardDivider ¶
type CardDivider = delivery.CardDivider
Aliases retain the existing renderer and card-builder API.
type CardElement ¶
type CardElement = delivery.CardElement
Aliases retain the existing renderer and card-builder API.
type CardHeader ¶
type CardHeader = delivery.CardHeader
Aliases retain the existing renderer and card-builder API.
type CardListItem ¶
type CardListItem = delivery.CardListItem
Aliases retain the existing renderer and card-builder API.
type CardMarkdown ¶
type CardMarkdown = delivery.CardMarkdown
Aliases retain the existing renderer and card-builder API.
type CardSelect ¶
type CardSelect = delivery.CardSelect
Aliases retain the existing renderer and card-builder API.
type CardSelectOption ¶
type CardSelectOption = delivery.CardSelectOption
Aliases retain the existing renderer and card-builder API.
type CardSubmissions ¶ added in v0.4.28
type CardSubmissions struct {
// contains filtered or unexported fields
}
CardSubmissions is independent of transport event deduplication. Plugins do not enter this gate; only final default-agent submissions do. Completed entries expire automatically; pending queue deliveries are never expired.
func (*CardSubmissions) Begin ¶ added in v0.4.28
func (s *CardSubmissions) Begin(e interaction.Event, ttl time.Duration) (func(error), bool)
func (*CardSubmissions) Contains ¶ added in v0.4.28
func (s *CardSubmissions) Contains(e interaction.Event) bool
type ChatMessage ¶
ChatMessage is a user-facing message derived from session events for IM / history UIs.
func MessageFromEvent ¶
func MessageFromEvent(ev agentkit.SessionEvent) *ChatMessage
MessageFromEvent maps one session event to a chat message when applicable.
func MessagesFromEvents ¶
func MessagesFromEvents(events []agentkit.SessionEvent) []ChatMessage
MessagesFromEvents derives chat-visible messages from session events.
func MessagesFromSession ¶
MessagesFromSession reads all session events and derives chat-visible messages.
type FileAttachment ¶
FileAttachment is an inbound file from an IM platform.
type ImageAttachment ¶
type ImageAttachment struct {
MimeType string
Data []byte
FileName string
// WorkPath is relative to the agent work dir (e.g. upload/foo.png).
WorkPath string
}
ImageAttachment is an inbound image from an IM platform.
type InboundOpts ¶ added in v0.1.6
type InboundOpts struct {
// Workspace resolves upload paths; when set, inbound files land under the
// same tenant root as session/store and tool/fs-workspace.
Workspace cw.Service
// DeferUploads leaves fresh downloaded files for the runner turn snapshot.
DeferUploads bool
// PresavedAttachments are attachments already on disk; their paths are
// appended to the user prompt as an attachment block.
PresavedAttachments []PresavedAttachment
}
InboundOpts configures optional inbound media handling.
func DeferredInboundOptsFor ¶ added in v0.4.40
func DeferredInboundOptsFor(ws cw.Service) *InboundOpts
DeferredInboundOptsFor opts runner-based adapters into turn-time saving. InboundOptsFor retains eager behavior for standalone legacy callers.
func InboundOptsFor ¶ added in v0.1.6
func InboundOptsFor(ws cw.Service) *InboundOpts
InboundOptsFor builds inbound media options from an optional workspace.
type Inbox ¶
type Inbox struct {
// contains filtered or unexported fields
}
Inbox bridges async platform events into blocking Receive.
type InstanceIdentity ¶ added in v0.4.35
type InstanceIdentity struct {
// contains filtered or unexported fields
}
InstanceIdentity lets aggregators assign a leaf identity before serving traffic. Atomic storage also protects native event callbacks during startup.
func (*InstanceIdentity) PlatformInstance ¶ added in v0.4.35
func (i *InstanceIdentity) PlatformInstance() string
func (*InstanceIdentity) SetPlatformInstance ¶ added in v0.4.35
func (i *InstanceIdentity) SetPlatformInstance(id string)
type InteractionCommand ¶ added in v0.4.27
type InteractionCommand struct {
Routing AgentRoutingConfig
Commands agentkit.Commands
Slash SlashContext
Metadata func(context.Context, string) map[string]any
Reply func(context.Context, string) error
}
InteractionCommand shares registered-command semantics with normal messages. Unknown commands leave the original interaction intact for plugins/fallback.
type InteractionDedup ¶ added in v0.4.27
type InteractionDedup struct {
// contains filtered or unexported fields
}
InteractionDedup reserves callbacks while work is in flight. Failed delivery releases the reservation; only completed work enters the replay window.
type InteractionOptions ¶
type InteractionOptions struct {
// contains filtered or unexported fields
}
InteractionOptions remembers option labels for platforms with short callback payloads (Telegram).
func (*InteractionOptions) Clear ¶
func (s *InteractionOptions) Clear(sessionID agentkit.SessionID)
func (*InteractionOptions) Reply ¶
func (s *InteractionOptions) Reply(sessionID agentkit.SessionID, requestID, userID string, index int) (permission.Reply, bool)
func (*InteractionOptions) Set ¶
func (s *InteractionOptions) Set(sessionID agentkit.SessionID, requestID string, replies []permission.Reply)
type InteractionProcessing ¶ added in v0.4.27
type InteractionProcessing struct {
Submissions *CardSubmissions
SubmissionTTL time.Duration
CloseCard func(context.Context, interaction.Event, string) error
NotifyUser func(context.Context, interaction.Event, string) error
Allowed func(context.Context, interaction.Event) bool
Mode string
Handlers []interaction.Handler
Builtin func(context.Context, interaction.Event) bool
Enrich func(context.Context, *interaction.Event)
Forward func(context.Context, interaction.Event) error
}
InteractionProcessing runs in the platform's background worker. Builtin must report actual handling; Enrich may fetch original card and restore routing.
type KeyedExecutor ¶ added in v0.4.44
type KeyedExecutor struct {
// contains filtered or unexported fields
}
KeyedExecutor admits work without blocking SDK callbacks. It preserves FIFO order per key, bounds active work and waiting tasks, and has no idle workers. Work must honor ctx; Stop cancels active work and discards queued closures.
func NewKeyedExecutor ¶ added in v0.4.44
func NewKeyedExecutor(concurrency, capacity int) *KeyedExecutor
func (*KeyedExecutor) Bind ¶ added in v0.4.44
func (e *KeyedExecutor) Bind(ctx context.Context)
Bind attaches host cancellation without inheriting the SDK request lifetime.
func (*KeyedExecutor) Cancel ¶ added in v0.4.44
func (e *KeyedExecutor) Cancel()
type MediaSender ¶ added in v0.1.6
type MediaSender func(ctx context.Context, sessionID agentkit.SessionID, part agentkit.ContentPart) error
MediaSender delivers a non-text assistant content part (image or document).
type MentionProfile ¶ added in v0.2.10
type MentionProfile struct {
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
}
MentionProfile is a resolved @mention participant for inbound metadata inject.
type MessageDedup ¶
type MessageDedup struct {
// contains filtered or unexported fields
}
MessageDedup tracks recently seen message IDs to prevent duplicate processing.
func (*MessageDedup) Admit ¶ added in v0.4.44
func (d *MessageDedup) Admit(msgID string, accept func() error) (bool, error)
Admit atomically records an ID only after nonblocking queue admission succeeds. A full/stopped executor can therefore return an SDK error without poisoning the dedup window. accept must not block or call back into this MessageDedup.
func (*MessageDedup) IsDuplicate ¶
func (d *MessageDedup) IsDuplicate(msgID string) bool
IsDuplicate returns true if msgID was already seen within the TTL window.
type Outbound ¶
type Outbound struct {
// contains filtered or unexported fields
}
Outbound handles agentkit outbound events with per-session text buffering.
func NewOutbound ¶
func NewOutbound(send TextSender, media MediaSender) *Outbound
func (*Outbound) SendAssistantMedia ¶ added in v0.3.39
func (o *Outbound) SendAssistantMedia(ctx context.Context, event agentkit.OutboundEvent, msg agentkit.ModelMessage) error
SendAssistantMedia delivers image/document parts from an assistant message event without sending text (for transports that already rendered text elsewhere).
type PresavedAttachment ¶ added in v0.3.30
type PresavedAttachment struct {
Owner *agentkit.AttachmentOwner
Path string
Mime string
Size int
OrigName string
Image bool
}
PresavedAttachment is an attachment already saved to disk by the platform (e.g. buffered pending attachments). Only metadata is carried; the bytes are already under upload/. Paths returned by SaveInboundAttachments are absolute.
func SaveInboundAttachments ¶ added in v0.3.30
func SaveInboundAttachments(route agentkit.RouteRef, files []FileAttachment, opts *InboundOpts) []PresavedAttachment
SaveInboundAttachments writes the given files to the upload directory and returns stable absolute paths plus metadata. Useful for platforms that buffer attachments before a text message arrives.
func SaveInboundAttachmentsAt ¶ added in v0.4.40
func SaveInboundAttachmentsAt(ctx context.Context, ws cw.Service, files []FileAttachment) ([]PresavedAttachment, error)
SaveInboundAttachmentsAt saves a file-first upload using an already-resolved ingress context. Its stable path and owner survive later cwd/session changes.
type SlashContext ¶ added in v0.1.6
type SlashContext struct {
Route agentkit.RouteRef
SessionScope agentkit.SessionScope
UserID string
Metadata map[string]any
}
SlashContext carries delivery routing and sessionScope for slash commands.
type SlashOutcome ¶
type SlashOutcome struct {
Kind SlashOutcomeKind
Reply string
}
SlashOutcome is the result of ProcessSlash.
func ProcessPlatformSlash ¶ added in v0.3.45
func ProcessPlatformSlash(ctx context.Context, routing AgentRoutingConfig, commands agentkit.Commands, slash SlashContext, text string) (SlashOutcome, error)
ProcessPlatformSlash runs ProcessSlash unless routing config disables platform slash.
func ProcessSlash ¶
func ProcessSlash(ctx context.Context, commands agentkit.Commands, slash SlashContext, text string) (SlashOutcome, error)
ProcessSlash resolves slash commands via the injected commands registry. Non-slash input returns SlashNotCommand.
type SlashOutcomeKind ¶
type SlashOutcomeKind int
SlashOutcomeKind describes how an inbound slash command was resolved.
const ( // SlashNotCommand means the text is not a slash command. SlashNotCommand SlashOutcomeKind = iota // SlashHandled means the platform should reply locally and not enqueue a turn. SlashHandled // SlashForward means the command is unknown; notify the user then forward to the agent. SlashForward )
Source Files
¶
- agent.go
- allowfrom.go
- attachments.go
- card.go
- card_delivery.go
- card_interaction.go
- card_submission.go
- commands.go
- dedup.go
- history.go
- inbox.go
- instance.go
- interaction_action.go
- interaction_card.go
- interaction_dedup.go
- interaction_forward.go
- interaction_options.go
- keyed_executor.go
- markdown_slack.go
- media.go
- metadata.go
- outbound.go
- redact.go
- turn_attachments.go
- upload_staging.go
- url.go