contract

package
v0.3.0-beta.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package contract defines the dependency-safe wire contract shared by Compozy and bridge adapter subprocesses.

Index

Constants

View Source
const (

	// MaxToolProgressErrorRunes caps provider-facing progress error details.
	MaxToolProgressErrorRunes = maxToolProgressErrorRunes
)

Variables

This section is empty.

Functions

func BridgeCheckStatusValues

func BridgeCheckStatusValues() []string

BridgeCheckStatusValues returns the closed status family in stable order.

func ControlMethodValues

func ControlMethodValues() []string

ControlMethodValues returns the closed method family in stable order.

func DeliveryAckOutcomeValues

func DeliveryAckOutcomeValues() []string

DeliveryAckOutcomeValues returns the closed acknowledgement outcomes in stable order.

func DeliveryEventTypeValues

func DeliveryEventTypeValues() []string

DeliveryEventTypeValues returns the closed wire values in stable order.

func InboundEditOperationValues

func InboundEditOperationValues() []string

InboundEditOperationValues returns the closed wire values in stable order.

func InboundEventFamilyValues

func InboundEventFamilyValues() []string

InboundEventFamilyValues returns the closed wire values in stable order.

func IsTerminalDeliveryEventType

func IsTerminalDeliveryEventType(value DeliveryEventType) bool

IsTerminalDeliveryEventType reports whether a lifecycle event is terminal.

func NormalizeBridgeTargetName

func NormalizeBridgeTargetName(value string) string

NormalizeBridgeTargetName canonicalizes display names for lookup.

func NormalizeBridgeTargetQualifier

func NormalizeBridgeTargetQualifier(value string) string

NormalizeBridgeTargetQualifier canonicalizes workspace and guild qualifiers.

func NormalizeDeliveryDefaultsJSON

func NormalizeDeliveryDefaultsJSON(raw json.RawMessage) (json.RawMessage, error)

NormalizeDeliveryDefaultsJSON validates and canonicalizes delivery defaults.

func NormalizeProviderConfigJSON

func NormalizeProviderConfigJSON(value json.RawMessage) (json.RawMessage, error)

NormalizeProviderConfigJSON validates and canonicalizes provider-owned configuration while rejecting operator-owned destinations.

func SlackBotScopes

func SlackBotScopes() []string

SlackBotScopes returns the canonical required bot scopes.

func ToolProgressPhaseValues

func ToolProgressPhaseValues() []string

ToolProgressPhaseValues returns the closed wire values in stable order.

func ValidateBridgeInstanceLifecycle

func ValidateBridgeInstanceLifecycle(enabled bool, status BridgeStatus) error

ValidateBridgeInstanceLifecycle enforces the enabled/status wire invariant.

func ValidateScopeWorkspaceID

func ValidateScopeWorkspaceID(scope Scope, workspaceID string) error

ValidateScopeWorkspaceID enforces the canonical scope and workspace invariant.

func ValidateWebhookDestinationIP

func ValidateWebhookDestinationIP(ip netip.Addr) error

ValidateWebhookDestinationIP rejects non-public callback destinations.

func ValidateWebhookPublicURL

func ValidateWebhookPublicURL(publicURL string) error

ValidateWebhookPublicURL enforces the public callback URL boundary.

func WebhookLocalTarget

func WebhookLocalTarget(instance BridgeInstance) (*url.URL, error)

WebhookLocalTarget resolves the provider-owned loopback listener used by the gateway proxy.

func WebhookPublicURL

func WebhookPublicURL(instance BridgeInstance) (string, error)

WebhookPublicURL returns the configured external callback URL.

Types

type BridgeCheckRecord

type BridgeCheckRecord struct {
	Check       string            `json:"check"`
	Status      BridgeCheckStatus `json:"status"`
	Remediation string            `json:"remediation"`
}

BridgeCheckRecord is one stable, redacted provider check result.

func FailedSecretCheck

func FailedSecretCheck(check string, binding string) BridgeCheckRecord

FailedSecretCheck reports a missing binding without exposing provider errors.

func PassCheck

func PassCheck(check string) BridgeCheckRecord

PassCheck builds a successful check.

func SkippedCheck

func SkippedCheck(check string, remediation string) BridgeCheckRecord

SkippedCheck builds an explicit skipped check.

func (BridgeCheckRecord) Validate

func (r BridgeCheckRecord) Validate() error

Validate enforces a named, actionable provider check result.

type BridgeCheckRequest

type BridgeCheckRequest struct {
	BridgeInstanceID string `json:"bridge_instance_id"`
}

BridgeCheckRequest selects the instance to inspect.

func (BridgeCheckRequest) Validate

func (r BridgeCheckRequest) Validate() error

Validate requires an explicit bridge instance.

type BridgeCheckResponse

type BridgeCheckResponse struct {
	Checks []BridgeCheckRecord `json:"checks"`
}

BridgeCheckResponse returns every provider check record.

func (BridgeCheckResponse) Validate

func (r BridgeCheckResponse) Validate() error

Validate rejects empty or malformed provider responses.

type BridgeCheckStatus

type BridgeCheckStatus string

BridgeCheckStatus is the closed result state for a provider check.

const (
	BridgeCheckStatusPass    BridgeCheckStatus = "pass"
	BridgeCheckStatusWarn    BridgeCheckStatus = "warn"
	BridgeCheckStatusFail    BridgeCheckStatus = "fail"
	BridgeCheckStatusSkipped BridgeCheckStatus = "skipped"
)

func (BridgeCheckStatus) Validate

func (s BridgeCheckStatus) Validate() error

Validate enforces the closed check-status family.

type BridgeDMPolicy

type BridgeDMPolicy string

BridgeDMPolicy controls direct messages from unpaired senders.

const (
	BridgeDMPolicyOpen      BridgeDMPolicy = "open"
	BridgeDMPolicyAllowlist BridgeDMPolicy = "allowlist"
	BridgeDMPolicyPairing   BridgeDMPolicy = "pairing"
)

func (BridgeDMPolicy) Normalize

func (p BridgeDMPolicy) Normalize() BridgeDMPolicy

Normalize returns the canonical direct-message policy.

func (BridgeDMPolicy) Validate

func (p BridgeDMPolicy) Validate() error

Validate reports whether the direct-message policy is supported.

type BridgeDegradation

type BridgeDegradation struct {
	Reason  BridgeDegradationReason `toml:"reason"            json:"reason"`
	Message string                  `toml:"message,omitempty" json:"message,omitempty"`
}

BridgeDegradation captures structured instance degradation metadata.

func NormalizeBridgeDegradation

func NormalizeBridgeDegradation(degradation BridgeDegradation) BridgeDegradation

NormalizeBridgeDegradation returns canonical degradation metadata.

func (BridgeDegradation) IsZero

func (d BridgeDegradation) IsZero() bool

IsZero reports whether the degradation carries any values.

func (BridgeDegradation) Validate

func (d BridgeDegradation) Validate() error

Validate reports whether the degradation is internally consistent.

type BridgeDegradationReason

type BridgeDegradationReason string

BridgeDegradationReason identifies an operational degradation cause.

const (
	BridgeDegradationReasonAuthFailed          BridgeDegradationReason = "auth_failed"
	BridgeDegradationReasonRateLimited         BridgeDegradationReason = "rate_limited"
	BridgeDegradationReasonWebhookInvalid      BridgeDegradationReason = "webhook_invalid"
	BridgeDegradationReasonProviderTimeout     BridgeDegradationReason = "provider_timeout"
	BridgeDegradationReasonTenantConfigInvalid BridgeDegradationReason = "tenant_config_invalid"
)

func (BridgeDegradationReason) Normalize

Normalize returns the canonical degradation reason.

func (BridgeDegradationReason) Validate

func (r BridgeDegradationReason) Validate() error

Validate reports whether the degradation reason is supported.

type BridgeInstance

type BridgeInstance struct {
	ID                   string               `json:"id"`
	Scope                Scope                `json:"scope"`
	WorkspaceID          string               `json:"workspace_id,omitempty"`
	Platform             string               `json:"platform"`
	ExtensionName        string               `json:"extension_name"`
	DisplayName          string               `json:"display_name"`
	Source               BridgeInstanceSource `json:"source,omitempty"`
	Enabled              bool                 `json:"enabled"`
	Status               BridgeStatus         `json:"status"`
	DMPolicy             BridgeDMPolicy       `json:"dm_policy,omitempty"`
	RoutingPolicy        RoutingPolicy        `json:"routing_policy"`
	ProviderConfig       json.RawMessage      `json:"provider_config,omitempty"`
	DeliveryDefaults     json.RawMessage      `json:"delivery_defaults,omitempty"`
	NotificationSuppress bool                 `json:"notification_suppress"`
	Degradation          *BridgeDegradation   `json:"degradation,omitempty"`
	CreatedAt            time.Time            `json:"created_at"`
	UpdatedAt            time.Time            `json:"updated_at"`
}

BridgeInstance is one daemon-owned bridge instance snapshot.

func NormalizeBridgeInstance

func NormalizeBridgeInstance(instance BridgeInstance) BridgeInstance

NormalizeBridgeInstance returns the canonical wire representation used by composition-layer adapters.

func (BridgeInstance) Validate

func (i BridgeInstance) Validate() error

Validate reports whether the bridge instance is complete and valid.

type BridgeInstanceSource

type BridgeInstanceSource string

BridgeInstanceSource identifies where a bridge instance originated.

const (
	// BridgeInstanceSourceDynamic identifies an operator-created instance.
	BridgeInstanceSourceDynamic BridgeInstanceSource = "dynamic"
	// BridgeInstanceSourcePackage identifies an extension-managed instance.
	BridgeInstanceSourcePackage BridgeInstanceSource = "package"
)

func (BridgeInstanceSource) Normalize

Normalize returns the canonical instance source.

func (BridgeInstanceSource) Validate

func (s BridgeInstanceSource) Validate() error

Validate reports whether the instance source is supported.

type BridgeInstanceTargetParams

type BridgeInstanceTargetParams struct {
	BridgeInstanceID string `json:"bridge_instance_id"`
}

BridgeInstanceTargetParams identifies one provider-owned bridge instance.

type BridgeStatus

type BridgeStatus string

BridgeStatus reports the lifecycle state of a bridge instance.

const (
	BridgeStatusDisabled     BridgeStatus = "disabled"
	BridgeStatusStarting     BridgeStatus = "starting"
	BridgeStatusReady        BridgeStatus = "ready"
	BridgeStatusDegraded     BridgeStatus = "degraded"
	BridgeStatusAuthRequired BridgeStatus = "auth_required"
	BridgeStatusError        BridgeStatus = "error"
)

func (BridgeStatus) Normalize

func (s BridgeStatus) Normalize() BridgeStatus

Normalize returns the canonical bridge status.

func (BridgeStatus) Validate

func (s BridgeStatus) Validate() error

Validate reports whether the status belongs to the closed status set.

type BridgeTargetSnapshot

type BridgeTargetSnapshot struct {
	CanonicalRoute string           `json:"canonical_route"`
	DisplayName    string           `json:"display_name"`
	TargetType     BridgeTargetType `json:"target_type"`
	Qualifier      string           `json:"qualifier,omitempty"`
	Capabilities   []string         `json:"capabilities,omitempty"`
	LastSeenAt     time.Time        `json:"last_seen_at,omitzero"`
}

BridgeTargetSnapshot is adapter-provided target data.

func (BridgeTargetSnapshot) Validate

func (s BridgeTargetSnapshot) Validate() error

Validate reports whether the snapshot has a stable provider identity.

type BridgeTargetSnapshotRequest

type BridgeTargetSnapshotRequest struct {
	BridgeInstanceID string `json:"bridge_instance_id"`
}

BridgeTargetSnapshotRequest selects an instance for target enumeration.

func (BridgeTargetSnapshotRequest) Validate

func (r BridgeTargetSnapshotRequest) Validate() error

Validate reports whether the request identifies an instance.

type BridgeTargetSnapshotResponse

type BridgeTargetSnapshotResponse struct {
	Targets []BridgeTargetSnapshot `json:"targets"`
}

BridgeTargetSnapshotResponse carries adapter-enumerated targets.

type BridgeTargetType

type BridgeTargetType string

BridgeTargetType identifies a provider target family.

const (
	BridgeTargetTypeChannel BridgeTargetType = "channel"
	BridgeTargetTypeUser    BridgeTargetType = "user"
	BridgeTargetTypeRoom    BridgeTargetType = "room"
	BridgeTargetTypeThread  BridgeTargetType = "thread"
	BridgeTargetTypeGroup   BridgeTargetType = "group"
)

func (BridgeTargetType) Normalize

func (t BridgeTargetType) Normalize() BridgeTargetType

Normalize returns the canonical target type.

func (BridgeTargetType) Validate

func (t BridgeTargetType) Validate() error

Validate reports whether the target type is supported.

type BridgeWebhookRegistrationRequest

type BridgeWebhookRegistrationRequest struct {
	BridgeInstanceID string `json:"bridge_instance_id"`
	PublicURL        string `json:"public_url,omitempty"`
}

BridgeWebhookRegistrationRequest selects the instance to register.

func (BridgeWebhookRegistrationRequest) Validate

Validate requires an explicit bridge instance.

type BridgeWebhookRegistrationResponse

type BridgeWebhookRegistrationResponse struct {
	Status      BridgeCheckStatus `json:"status"`
	Remediation string            `json:"remediation"`
}

BridgeWebhookRegistrationResponse is the provider registration result.

func (BridgeWebhookRegistrationResponse) Validate

Validate enforces an actionable registration result.

type BridgesInstancesReportStateParams

type BridgesInstancesReportStateParams struct {
	BridgeInstanceID string             `json:"bridge_instance_id"`
	Status           BridgeStatus       `json:"status"`
	Degradation      *BridgeDegradation `json:"degradation,omitempty"`
	ClearDegradation bool               `json:"clear_degradation,omitempty"`
}

BridgesInstancesReportStateParams reports adapter-observed instance state.

type BridgesMessagesIngestResult

type BridgesMessagesIngestResult struct {
	SessionID    string     `json:"session_id"`
	RouteCreated bool       `json:"route_created"`
	RoutingKey   RoutingKey `json:"routing_key"`
}

BridgesMessagesIngestResult reports the resolved session association.

type ControlMethod

type ControlMethod string

ControlMethod identifies a provider control operation.

const (
	ControlMethodCheck           ControlMethod = "bridges/check"
	ControlMethodWebhookRegister ControlMethod = "bridges/webhook/register"
)

func (ControlMethod) Validate

func (m ControlMethod) Validate() error

Validate enforces the closed provider control method family.

type DeliveryAck

type DeliveryAck struct {
	DeliveryID             string               `json:"delivery_id"`
	Seq                    int64                `json:"seq"`
	RemoteMessageID        string               `json:"remote_message_id,omitempty"`
	ReplaceRemoteMessageID string               `json:"replace_remote_message_id,omitempty"`
	Outcome                DeliveryAckOutcome   `json:"outcome,omitempty"`
	Error                  *DeliveryErrorDetail `json:"error,omitempty"`
}

DeliveryAck acknowledges one delivery request without conflating receipt with provider success.

func NormalizeDeliveryAck

func NormalizeDeliveryAck(ack DeliveryAck) DeliveryAck

NormalizeDeliveryAck returns a canonical acknowledgement.

func (DeliveryAck) ValidateFor

func (a DeliveryAck) ValidateFor(event DeliveryEvent) error

ValidateFor reports whether the acknowledgement belongs to an event.

type DeliveryAckOutcome

type DeliveryAckOutcome string

DeliveryAckOutcome identifies the provider-side result of one delivery request.

const (
	DeliveryAckOutcomeSuccess                    DeliveryAckOutcome = "success"
	DeliveryAckOutcomeCommittedResultUnavailable DeliveryAckOutcome = "committed_result_unavailable"
)

func (DeliveryAckOutcome) Normalize

func (o DeliveryAckOutcome) Normalize() DeliveryAckOutcome

Normalize returns the canonical acknowledgement outcome; empty means success.

func (DeliveryAckOutcome) Validate

func (o DeliveryAckOutcome) Validate() error

Validate reports whether the acknowledgement outcome is supported.

type DeliveryErrorDetail

type DeliveryErrorDetail struct {
	Message string `json:"message"`
}

DeliveryErrorDetail captures a typed delivery failure.

func (DeliveryErrorDetail) Validate

func (d DeliveryErrorDetail) Validate() error

Validate reports whether the error carries a message.

type DeliveryEvent

type DeliveryEvent struct {
	DeliveryID       string                    `json:"delivery_id"`
	BridgeInstanceID string                    `json:"bridge_instance_id"`
	RoutingKey       RoutingKey                `json:"routing_key"`
	DeliveryTarget   DeliveryTarget            `json:"delivery_target"`
	Seq              int64                     `json:"seq"`
	EventType        DeliveryEventType         `json:"event_type"`
	Content          MessageContent            `json:"content"`
	Final            bool                      `json:"final"`
	Operation        DeliveryOperation         `json:"operation,omitempty"`
	Reference        *DeliveryMessageReference `json:"reference,omitempty"`
	Error            *DeliveryErrorDetail      `json:"error,omitempty"`
	Resume           *DeliveryResumeState      `json:"resume,omitempty"`
	Progress         *ToolProgress             `json:"progress,omitempty"`
	ProviderMetadata json.RawMessage           `json:"provider_metadata,omitempty"`
}

DeliveryEvent is the daemon-owned outbound projection sent to an adapter.

func NormalizeDeliveryEvent

func NormalizeDeliveryEvent(event DeliveryEvent) DeliveryEvent

NormalizeDeliveryEvent returns the canonical wire event with independently owned typed payloads.

func (DeliveryEvent) IsLifecycleOnlyFinal

func (e DeliveryEvent) IsLifecycleOnlyFinal() bool

IsLifecycleOnlyFinal reports whether the event closes progress without text.

func (DeliveryEvent) Validate

func (e DeliveryEvent) Validate() error

Validate reports whether the delivery event is internally consistent.

type DeliveryEventType

type DeliveryEventType string

DeliveryEventType is one closed daemon-to-adapter lifecycle event.

const (
	DeliveryEventTypeStart    DeliveryEventType = "start"
	DeliveryEventTypeDelta    DeliveryEventType = "delta"
	DeliveryEventTypeFinal    DeliveryEventType = "final"
	DeliveryEventTypeError    DeliveryEventType = "error"
	DeliveryEventTypeResume   DeliveryEventType = "resume"
	DeliveryEventTypeDelete   DeliveryEventType = "delete"
	DeliveryEventTypeProgress DeliveryEventType = "progress"
)

func NormalizeDeliveryEventType

func NormalizeDeliveryEventType(value DeliveryEventType) DeliveryEventType

NormalizeDeliveryEventType returns the canonical lifecycle event type.

type DeliveryMessageReference

type DeliveryMessageReference struct {
	DeliveryID      string `json:"delivery_id,omitempty"`
	RemoteMessageID string `json:"remote_message_id,omitempty"`
}

DeliveryMessageReference identifies one previously delivered message.

func NormalizeDeliveryMessageReference

func NormalizeDeliveryMessageReference(reference DeliveryMessageReference) DeliveryMessageReference

NormalizeDeliveryMessageReference returns a canonical prior-message handle.

func (DeliveryMessageReference) Validate

func (r DeliveryMessageReference) Validate() error

Validate reports whether the reference carries a prior message handle.

type DeliveryMode

type DeliveryMode string

DeliveryMode identifies daemon-owned outbound delivery behavior.

const (
	DeliveryModeDirectSend DeliveryMode = "direct-send"
	DeliveryModeReply      DeliveryMode = "reply"
)

func (DeliveryMode) Validate

func (m DeliveryMode) Validate() error

Validate reports whether the delivery mode is supported.

type DeliveryOperation

type DeliveryOperation string

DeliveryOperation identifies post, edit, or delete behavior.

const (
	DeliveryOperationPost   DeliveryOperation = "post"
	DeliveryOperationEdit   DeliveryOperation = "edit"
	DeliveryOperationDelete DeliveryOperation = "delete"
)

func (DeliveryOperation) Normalize

func (o DeliveryOperation) Normalize() DeliveryOperation

Normalize returns the canonical delivery operation.

func (DeliveryOperation) Validate

func (o DeliveryOperation) Validate() error

Validate reports whether the delivery operation is supported.

type DeliveryRequest

type DeliveryRequest struct {
	Event    DeliveryEvent     `json:"event"`
	Snapshot *DeliverySnapshot `json:"snapshot,omitempty"`
}

DeliveryRequest is the negotiated daemon-to-extension request payload.

func (DeliveryRequest) Validate

func (r DeliveryRequest) Validate() error

Validate reports whether the negotiated request is internally consistent.

type DeliveryResumeState

type DeliveryResumeState struct {
	LatestEventType DeliveryEventType `json:"latest_event_type"`
}

DeliveryResumeState captures the resumable delivery phase.

func (DeliveryResumeState) Validate

func (s DeliveryResumeState) Validate() error

Validate reports whether the resume state references a supported event.

type DeliverySnapshot

type DeliverySnapshot struct {
	DeliveryID             string                    `json:"delivery_id"`
	SessionID              string                    `json:"session_id"`
	TurnID                 string                    `json:"turn_id"`
	BridgeInstanceID       string                    `json:"bridge_instance_id"`
	RoutingKey             RoutingKey                `json:"routing_key"`
	DeliveryTarget         DeliveryTarget            `json:"delivery_target"`
	LatestSeq              int64                     `json:"latest_seq"`
	LatestEventType        DeliveryEventType         `json:"latest_event_type"`
	CurrentContent         MessageContent            `json:"current_content"`
	Operation              DeliveryOperation         `json:"operation,omitempty"`
	Reference              *DeliveryMessageReference `json:"reference,omitempty"`
	ProviderMetadata       json.RawMessage           `json:"provider_metadata,omitempty"`
	LastSentSeq            int64                     `json:"last_sent_seq,omitempty"`
	LastAckedSeq           int64                     `json:"last_acked_seq,omitempty"`
	RemoteMessageID        string                    `json:"remote_message_id,omitempty"`
	ReplaceRemoteMessageID string                    `json:"replace_remote_message_id,omitempty"`
	Final                  bool                      `json:"final"`
	Error                  string                    `json:"error,omitempty"`
	UpdatedAt              time.Time                 `json:"updated_at"`
}

DeliverySnapshot captures resumable state for one active delivery.

func NormalizeDeliverySnapshot

func NormalizeDeliverySnapshot(snapshot DeliverySnapshot) DeliverySnapshot

NormalizeDeliverySnapshot returns the canonical resumable wire snapshot.

func (DeliverySnapshot) Validate

func (s DeliverySnapshot) Validate() error

Validate reports whether the snapshot can resume a delivery.

type DeliveryTarget

type DeliveryTarget struct {
	BridgeInstanceID string       `json:"bridge_instance_id"`
	PeerID           string       `json:"peer_id,omitempty"`
	ThreadID         string       `json:"thread_id,omitempty"`
	GroupID          string       `json:"group_id,omitempty"`
	Mode             DeliveryMode `json:"mode,omitempty"`
}

DeliveryTarget identifies an outbound destination within one bridge instance.

func (DeliveryTarget) IsZero

func (t DeliveryTarget) IsZero() bool

IsZero reports whether the target carries any values.

func (DeliveryTarget) Validate

func (t DeliveryTarget) Validate() error

Validate reports whether the target contains the required identity.

type InboundAction

type InboundAction struct {
	ActionID  string `json:"action_id"`
	MessageID string `json:"message_id,omitempty"`
	Value     string `json:"value,omitempty"`
	TriggerID string `json:"trigger_id,omitempty"`
}

InboundAction captures a button/action interaction.

func (InboundAction) Validate

func (a InboundAction) Validate() error

Validate reports whether the action identifies its action.

type InboundCommand

type InboundCommand struct {
	Command   string `json:"command"`
	Text      string `json:"text,omitempty"`
	TriggerID string `json:"trigger_id,omitempty"`
}

InboundCommand captures a slash-command style interaction.

func (InboundCommand) Validate

func (c InboundCommand) Validate() error

Validate reports whether the command identifies its action.

type InboundEdit

type InboundEdit struct {
	MessageID         string               `json:"message_id"`
	NewText           string               `json:"new_text"`
	OriginalTimestamp time.Time            `json:"original_timestamp"`
	Operation         InboundEditOperation `json:"operation"`
}

InboundEdit captures an update or deletion of an existing message.

func (InboundEdit) Validate

func (e InboundEdit) Validate() error

Validate reports whether the edit carries an unambiguous payload.

type InboundEditOperation

type InboundEditOperation string

InboundEditOperation distinguishes replacement from deletion.

const (
	InboundEditOperationUpdated InboundEditOperation = "updated"
	InboundEditOperationDeleted InboundEditOperation = "deleted"
)

func (InboundEditOperation) Normalize

Normalize returns the canonical edit operation.

func (InboundEditOperation) Validate

func (o InboundEditOperation) Validate() error

Validate reports whether the edit operation is supported.

type InboundEventFamily

type InboundEventFamily string

InboundEventFamily identifies a typed inbound event family.

const (
	InboundEventFamilyMessage  InboundEventFamily = "message"
	InboundEventFamilyCommand  InboundEventFamily = "command"
	InboundEventFamilyAction   InboundEventFamily = "action"
	InboundEventFamilyReaction InboundEventFamily = "reaction"
	InboundEventFamilyEdit     InboundEventFamily = "edit"
)

func (InboundEventFamily) Normalize

func (f InboundEventFamily) Normalize() InboundEventFamily

Normalize returns the canonical inbound event family.

func (InboundEventFamily) Validate

func (f InboundEventFamily) Validate() error

Validate reports whether the inbound event family is supported.

type InboundMessageEnvelope

type InboundMessageEnvelope struct {
	BridgeInstanceID  string                  `json:"bridge_instance_id"`
	Scope             Scope                   `json:"scope"`
	WorkspaceID       string                  `json:"workspace_id,omitempty"`
	PeerID            string                  `json:"peer_id,omitempty"`
	ThreadID          string                  `json:"thread_id,omitempty"`
	GroupID           string                  `json:"group_id,omitempty"`
	PlatformMessageID string                  `json:"platform_message_id,omitempty"`
	ReceivedAt        time.Time               `json:"received_at"`
	Sender            MessageSender           `json:"sender"`
	Content           MessageContent          `json:"content,omitzero"`
	Attachments       []MessageAttachment     `json:"attachments,omitempty"`
	EventFamily       InboundEventFamily      `json:"event_family"`
	Command           *InboundCommand         `json:"command,omitempty"`
	Action            *InboundAction          `json:"action,omitempty"`
	Reaction          *InboundReaction        `json:"reaction,omitempty"`
	Edit              *InboundEdit            `json:"edit,omitempty"`
	ReplyToText       string                  `json:"reply_to_text,omitempty"`
	ReplyToAuthorID   string                  `json:"reply_to_author_id,omitempty"`
	ReplyToAuthorName string                  `json:"reply_to_author_name,omitempty"`
	Conversation      *NetworkConversationRef `json:"conversation,omitempty"`
	ProviderMetadata  json.RawMessage         `json:"provider_metadata,omitempty"`
	IdempotencyKey    string                  `json:"idempotency_key"`
}

InboundMessageEnvelope is the normalized bridge ingest payload.

func NormalizeInboundMessageEnvelope

func NormalizeInboundMessageEnvelope(envelope InboundMessageEnvelope) InboundMessageEnvelope

NormalizeInboundMessageEnvelope returns the canonical wire envelope with independently owned mutable payloads.

func (InboundMessageEnvelope) NetworkConversationRef

func (e InboundMessageEnvelope) NetworkConversationRef() (NetworkConversationRef, bool, error)

NetworkConversationRef returns only the explicit Compozy conversation mapping.

func (InboundMessageEnvelope) Validate

func (e InboundMessageEnvelope) Validate() error

Validate reports whether the inbound envelope is internally consistent.

type InboundReaction

type InboundReaction struct {
	MessageID string `json:"message_id"`
	Emoji     string `json:"emoji"`
	RawEmoji  string `json:"raw_emoji,omitempty"`
	Added     bool   `json:"added"`
}

InboundReaction captures a reaction add/remove interaction.

func (InboundReaction) Validate

func (r InboundReaction) Validate() error

Validate reports whether the reaction identifies its message and emoji.

type MessageAttachment

type MessageAttachment struct {
	ID       string `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	MIMEType string `json:"mime_type,omitempty"`
	URL      string `json:"url,omitempty"`
}

MessageAttachment captures normalized attachment metadata.

type MessageContent

type MessageContent struct {
	Text string `json:"text,omitempty"`
}

MessageContent carries normalized text content.

type MessageSender

type MessageSender struct {
	ID          string `json:"id,omitempty"`
	Username    string `json:"username,omitempty"`
	DisplayName string `json:"display_name,omitempty"`
}

MessageSender identifies the upstream actor that produced a message.

type NetworkConversationRef

type NetworkConversationRef struct {
	Channel     string                     `json:"channel"`
	Surface     NetworkConversationSurface `json:"surface"`
	ThreadID    string                     `json:"thread_id,omitempty"`
	DirectID    string                     `json:"direct_id,omitempty"`
	WorkID      string                     `json:"work_id,omitempty"`
	ReplyTo     string                     `json:"reply_to,omitempty"`
	TraceID     string                     `json:"trace_id,omitempty"`
	CausationID string                     `json:"causation_id,omitempty"`
}

NetworkConversationRef carries an explicit bridge-to-Compozy conversation mapping.

func NormalizeNetworkConversationRef

func NormalizeNetworkConversationRef(reference NetworkConversationRef) NetworkConversationRef

NormalizeNetworkConversationRef returns a canonical explicit conversation mapping.

func (NetworkConversationRef) Validate

func (r NetworkConversationRef) Validate() error

Validate reports whether the mapping selects one Compozy conversation.

type NetworkConversationSurface

type NetworkConversationSurface string

NetworkConversationSurface identifies an Compozy conversation container.

const (
	NetworkConversationSurfaceThread NetworkConversationSurface = "thread"
	NetworkConversationSurfaceDirect NetworkConversationSurface = "direct"
)

func (NetworkConversationSurface) Normalize

Normalize returns the canonical conversation surface.

type ProgressConfig

type ProgressConfig struct {
	ToolProgress ProgressMode     `json:"tool_progress"`
	Grouping     ProgressGrouping `json:"grouping"`
	Typing       bool             `json:"typing"`
	Reactions    bool             `json:"reactions"`
	PreviewLimit int              `json:"-"`
	EditInterval time.Duration    `json:"-"`
}

ProgressConfig is the effective bridge progress configuration.

func NormalizeProgressConfig

func NormalizeProgressConfig(config ProgressConfig) ProgressConfig

NormalizeProgressConfig applies the canonical internal defaults used by the wire contract.

func ResolveProgressConfig

func ResolveProgressConfig(instance *BridgeInstance, platform string) ProgressConfig

ResolveProgressConfig applies instance, platform, and global defaults.

func (ProgressConfig) Validate

func (c ProgressConfig) Validate() error

Validate reports whether all progress settings are supported.

type ProgressGrouping

type ProgressGrouping string

ProgressGrouping controls whether progress lines accumulate or remain separate.

const (
	ProgressGroupingAccumulate ProgressGrouping = "accumulate"
	ProgressGroupingSeparate   ProgressGrouping = "separate"
)

func (ProgressGrouping) Normalize

func (g ProgressGrouping) Normalize() ProgressGrouping

Normalize returns the canonical progress grouping.

func (ProgressGrouping) Validate

func (g ProgressGrouping) Validate() error

Validate reports whether the progress grouping is supported.

type ProgressMode

type ProgressMode string

ProgressMode controls which tool lifecycle events become presentation events.

const (
	ProgressModeOff     ProgressMode = "off"
	ProgressModeNew     ProgressMode = "new"
	ProgressModeAll     ProgressMode = "all"
	ProgressModeVerbose ProgressMode = "verbose"
)

func (ProgressMode) Normalize

func (m ProgressMode) Normalize() ProgressMode

Normalize returns the canonical progress mode.

func (ProgressMode) Validate

func (m ProgressMode) Validate() error

Validate reports whether the progress mode is supported.

type RoutingDimensions

type RoutingDimensions struct {
	PeerID   string `json:"peer_id,omitempty"`
	ThreadID string `json:"thread_id,omitempty"`
	GroupID  string `json:"group_id,omitempty"`
}

RoutingDimensions carries platform-normalized routing identity.

type RoutingKey

type RoutingKey struct {
	Scope            Scope  `json:"scope"`
	WorkspaceID      string `json:"workspace_id,omitempty"`
	BridgeInstanceID string `json:"bridge_instance_id"`
	PeerID           string `json:"peer_id,omitempty"`
	ThreadID         string `json:"thread_id,omitempty"`
	GroupID          string `json:"group_id,omitempty"`
}

RoutingKey is the canonical identity used to resolve bridge traffic.

func BuildRoutingKey

func BuildRoutingKey(instance BridgeInstance, dims RoutingDimensions) (RoutingKey, error)

BuildRoutingKey constructs a key from an instance and selected dimensions.

func NormalizeRoutingKey

func NormalizeRoutingKey(key RoutingKey) RoutingKey

NormalizeRoutingKey returns the canonical wire routing identity.

func (RoutingKey) Hash

func (k RoutingKey) Hash() (string, error)

Hash returns the stable SHA-256 hash of the serialized key.

func (RoutingKey) Serialize

func (k RoutingKey) Serialize() (string, error)

Serialize returns the stable representation used for routing-key hashing.

func (RoutingKey) Validate

func (k RoutingKey) Validate() error

Validate reports whether the key carries its required base identity.

type RoutingPolicy

type RoutingPolicy struct {
	IncludePeer   bool `json:"include_peer"`
	IncludeThread bool `json:"include_thread"`
	IncludeGroup  bool `json:"include_group"`
}

RoutingPolicy selects the platform dimensions used for routing.

func (RoutingPolicy) Validate

func (p RoutingPolicy) Validate() error

Validate reports whether the routing policy is internally consistent.

type Scope

type Scope string

Scope identifies whether a bridge resource is daemon-global or workspace-owned.

const (
	// ScopeGlobal identifies a daemon-global bridge resource.
	ScopeGlobal Scope = "global"
	// ScopeWorkspace identifies a workspace-owned bridge resource.
	ScopeWorkspace Scope = "workspace"
)

func (Scope) Normalize

func (s Scope) Normalize() Scope

Normalize preserves the canonical scope.

func (Scope) Validate

func (s Scope) Validate() error

Validate reports whether the scope is supported.

type ToolProgress

type ToolProgress struct {
	ToolCallID string            `json:"tool_call_id"`
	ToolID     string            `json:"tool_id"`
	Phase      ToolProgressPhase `json:"phase"`
	Label      string            `json:"label"`
	Preview    string            `json:"preview,omitempty"`
	Emoji      string            `json:"emoji,omitempty"`
	DurationMS int64             `json:"duration_ms,omitempty"`
	Error      string            `json:"error,omitempty"`
	Index      int               `json:"index"`
}

ToolProgress is presentation-only tool lifecycle data.

func NormalizeToolProgress

func NormalizeToolProgress(progress ToolProgress) ToolProgress

NormalizeToolProgress returns canonical presentation-only progress data.

func (ToolProgress) Validate

func (p ToolProgress) Validate() error

Validate enforces the typed, redacted progress wire contract.

type ToolProgressPhase

type ToolProgressPhase string

ToolProgressPhase is one closed tool lifecycle phase.

const (
	ToolProgressPhaseStarted   ToolProgressPhase = "started"
	ToolProgressPhaseCompleted ToolProgressPhase = "completed"
	ToolProgressPhaseFailed    ToolProgressPhase = "failed"
)

func (ToolProgressPhase) Normalize

func (p ToolProgressPhase) Normalize() ToolProgressPhase

Normalize returns the canonical progress phase.

func (ToolProgressPhase) Validate

func (p ToolProgressPhase) Validate() error

Validate reports whether the phase belongs to the progress contract.

Jump to

Keyboard shortcuts

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