bridges

package
v0.3.0-beta.24 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package bridges defines the daemon-owned bridge domain models shared by persistence, runtime, and transport layers.

Index

Constants

View Source
const (
	// BridgeCatalogSortName preserves the operator-facing scope and display-name order.
	BridgeCatalogSortName = "name"

	// DefaultBridgeCatalogLimit bounds public bridge catalog reads by default.
	DefaultBridgeCatalogLimit = 50
	// MaxBridgeCatalogLimit caps one public bridge catalog page.
	MaxBridgeCatalogLimit = 200
)
View Source
const (
	// BridgeInstanceResourceKind is the canonical desired-state kind for bridge instances.
	BridgeInstanceResourceKind resources.ResourceKind = "bridge.instance"
)
View Source
const (
	// BridgeTaskNotificationStream is the durable task event stream consumed by subscriptions.
	BridgeTaskNotificationStream = "task_events"
)
View Source
const DeliveryResultUnavailableMessage = "provider mutation may have committed, but the bridge delivery " +
	"result is unavailable"

DeliveryResultUnavailableMessage is the safe public explanation used when a provider mutation may have committed but no trustworthy result was returned.

Variables

View Source
var (
	// ErrBridgeCatalogQueryInvalid reports an invalid public bridge catalog query.
	ErrBridgeCatalogQueryInvalid = errors.New("bridges: bridge catalog query is invalid")
	// ErrBridgeCatalogCursorInvalid reports a malformed or query-mismatched catalog cursor.
	ErrBridgeCatalogCursorInvalid = errors.New("bridges: bridge catalog cursor is invalid")
	// ErrBridgeCatalogHydrationIncomplete reports a selected row lost before bounded hydration.
	ErrBridgeCatalogHydrationIncomplete = errors.New("bridges: bridge catalog hydration is incomplete")
)
View Source
var (
	// ErrDeliveryLedgerNotFound reports that no durable delivery matched a checkpoint.
	ErrDeliveryLedgerNotFound = errors.New("bridges: delivery ledger record not found")
	// ErrDeliveryLedgerConflict reports a duplicate identity or non-monotonic checkpoint.
	ErrDeliveryLedgerConflict = errors.New("bridges: delivery ledger conflict")
)
View Source
var (
	// ErrDeliveryNotFound reports that no active or retained delivery matched the lookup.
	ErrDeliveryNotFound = errors.New("bridges: delivery not found")
	// ErrDeliveryQueueSaturated reports that a bounded delivery queue could not accept more work.
	ErrDeliveryQueueSaturated = errors.New("bridges: delivery queue saturated")
	// ErrDeliveryIDConflict reports that a caller-supplied delivery id is already active.
	ErrDeliveryIDConflict = errors.New("bridges: delivery id conflict")
	// ErrDeliveryTransportUnavailable reports that the broker has no usable extension delivery transport.
	ErrDeliveryTransportUnavailable = errors.New("bridges: delivery transport unavailable")
	// ErrBrokerClosed reports that the delivery broker no longer admits mutable work.
	ErrBrokerClosed = errors.New("bridges: delivery broker closed")
)
View Source
var (
	// ErrBridgeTaskSubscriptionNotFound reports that no bridge task subscription matched the lookup.
	ErrBridgeTaskSubscriptionNotFound = errors.New("bridges: bridge task subscription not found")
	// ErrInvalidBridgeTaskSubscription reports malformed bridge task subscription data.
	ErrInvalidBridgeTaskSubscription = errors.New("bridges: invalid bridge task subscription")
)
View Source
var (
	// ErrBridgeInstanceNotFound reports that no persisted bridge instance matched the lookup.
	ErrBridgeInstanceNotFound = errors.New("bridges: bridge instance not found")
	// ErrBridgeTargetDirectoryUnavailable reports that the daemon has no target-directory persistence surface.
	ErrBridgeTargetDirectoryUnavailable = errors.New("bridges: bridge target directory unavailable")
	// ErrBridgeTargetUnknown reports that no persisted bridge target matched the lookup.
	ErrBridgeTargetUnknown = errors.New("bridges: bridge target unknown")
	// ErrBridgeTargetAmbiguous reports that a friendly bridge target lookup matched multiple candidates.
	ErrBridgeTargetAmbiguous = errors.New("bridges: bridge target ambiguous")
	// ErrInvalidBridgeTarget reports malformed target-directory input.
	ErrInvalidBridgeTarget = errors.New("bridges: invalid bridge target")
	// ErrBridgeInstanceUnavailable reports that the instance exists but cannot currently accept routing work.
	ErrBridgeInstanceUnavailable = errors.New("bridges: bridge instance unavailable")
	// ErrInvalidBridgeSecretBinding reports that a bridge secret binding payload
	// is malformed or unsupported by the active daemon secret backend.
	ErrInvalidBridgeSecretBinding = errors.New("bridges: invalid bridge secret binding")
	// ErrBridgeSecretBindingNotFound reports that no persisted secret binding matched the lookup.
	ErrBridgeSecretBindingNotFound = errors.New("bridges: bridge secret binding not found")
	// ErrBridgeRouteNotFound reports that no persisted route matched the lookup.
	ErrBridgeRouteNotFound = errors.New("bridges: bridge route not found")
	// ErrIngestDedupRecordNotFound reports that no active ingest dedup record matched the lookup.
	ErrIngestDedupRecordNotFound = errors.New("bridges: ingest dedup record not found")
	// ErrInvalidBridgeStateTransition reports that the requested instance lifecycle transition is not allowed.
	ErrInvalidBridgeStateTransition = errors.New("bridges: invalid bridge state transition")
	// ErrBridgeInstanceReadOnly reports that a managed bridge instance does not
	// allow direct spec mutation through the generic CRUD surface.
	ErrBridgeInstanceReadOnly = errors.New("bridges: bridge instance is managed and read-only")
	// ErrBridgeNotificationSuppressed reports an intentional per-instance
	// notification drop that should still advance notification cursors.
	ErrBridgeNotificationSuppressed = errors.New("bridges: bridge notification suppressed")
)
View Source
var (
	// ErrBridgeControlTransportUnavailable reports that no extension runtime can execute a provider control call.
	ErrBridgeControlTransportUnavailable = errors.New("bridges: control transport unavailable")
)
View Source
var (
	// ErrDeliveryReconciliationPending reports that durable boot recovery has not completed.
	ErrDeliveryReconciliationPending = errors.New("bridges: delivery reconciliation pending")
)
View Source
var ErrTerminalTaskNotificationMismatch = errors.New("bridges: terminal task notification state mismatch")

ErrTerminalTaskNotificationMismatch reports a replayed terminal task event that claims finality but no longer agrees with the durable task/run state.

Functions

func ApplyResourceState

func ApplyResourceState(ctx context.Context, store ResourceProjectionStore, plan resources.ProjectionPlan) error

ApplyResourceState atomically swaps the daemon-visible bridge desired runtime state.

func BridgeInstanceToContract

func BridgeInstanceToContract(instance BridgeInstance) bridgecontract.BridgeInstance

BridgeInstanceToContract maps one domain snapshot into its provider-facing wire contract.

func DeliveryLedgerStateValues

func DeliveryLedgerStateValues() []string

DeliveryLedgerStateValues returns the closed durable state values in stable order.

func NewBridgeInstanceResourceCodec

func NewBridgeInstanceResourceCodec(
	providerLookup BridgeProviderLookup,
) (resources.KindCodec[BridgeInstanceSpec], error)

NewBridgeInstanceResourceCodec builds the typed codec for bridge.instance records.

func NormalizeBridgeTargetName

func NormalizeBridgeTargetName(value string) string

NormalizeBridgeTargetName canonicalizes display-name hints for lookup.

func NormalizeBridgeTargetQualifier

func NormalizeBridgeTargetQualifier(value string) string

NormalizeBridgeTargetQualifier canonicalizes workspace/guild qualifiers for lookup.

func NormalizeDeliveryDefaultsJSON

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

NormalizeDeliveryDefaultsJSON validates and canonicalizes bridge delivery default JSON.

func ResourceScopeForBridge

func ResourceScopeForBridge(scope Scope, workspaceID string) resources.ResourceScope

ResourceScopeForBridge converts bridge scope fields into the shared resource scope.

func SlackBotEvents

func SlackBotEvents() []string

SlackBotEvents returns a defensive copy of the canonical subscribed bot events.

func SlackBotScopes

func SlackBotScopes() []string

SlackBotScopes returns a defensive copy of the canonical required bot scopes.

func SlackRequiredScopesForEvent

func SlackRequiredScopesForEvent(event string) []string

SlackRequiredScopesForEvent returns the read scopes required by one subscribed event.

func ValidateInstanceStateTransition

func ValidateInstanceStateTransition(current BridgeInstance, nextEnabled bool, nextStatus BridgeStatus) error

ValidateInstanceStateTransition reports whether the next enabled/status pair is a valid lifecycle transition from the current instance state.

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 any address that is not safe for a public callback reachability probe.

func WebhookLocalTarget

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

WebhookLocalTarget returns the validated loopback destination for gateway callback proxying.

func WebhookPublicURL

func WebhookPublicURL(instance BridgeInstance) (string, error)

WebhookPublicURL returns the configured full external provider callback URL.

Types

type BridgeCatalogFacets

type BridgeCatalogFacets struct {
	Platforms map[string]int
	Statuses  map[BridgeStatus]int
}

BridgeCatalogFacets reports exact counts for the complete filtered authority.

type BridgeCatalogItem

type BridgeCatalogItem struct {
	Instance        BridgeInstance
	EffectiveStatus BridgeStatus
}

BridgeCatalogItem combines persisted bridge configuration with its effective runtime status.

type BridgeCatalogPage

type BridgeCatalogPage struct {
	Items      []BridgeCatalogItem
	Facets     BridgeCatalogFacets
	NextCursor string
	HasMore    bool
	Total      int
	Limit      int
}

BridgeCatalogPage is one filtered, counted, stable bridge catalog page.

func BuildBridgeCatalogPage

func BuildBridgeCatalogPage(
	instances []BridgeInstance,
	effectiveStatuses map[string]BridgeStatus,
	query BridgeCatalogQuery,
) (BridgeCatalogPage, error)

BuildBridgeCatalogPage filters and orders the visible authority before applying a stable cut.

func HydrateBridgeCatalogPage

func HydrateBridgeCatalogPage(
	selection BridgeCatalogRecordPage,
	instances []BridgeInstance,
) (BridgeCatalogPage, error)

HydrateBridgeCatalogPage binds one lean page to its bounded full-instance batch.

type BridgeCatalogQuery

type BridgeCatalogQuery struct {
	ReadScope   store.ReadScope
	Scope       string
	WorkspaceID string
	Search      string
	Platform    string
	Status      BridgeStatus
	Sort        string
	Cursor      string
	Limit       int
}

BridgeCatalogQuery describes one bounded public bridge catalog page.

func NormalizeBridgeCatalogQuery

func NormalizeBridgeCatalogQuery(query BridgeCatalogQuery) (BridgeCatalogQuery, error)

NormalizeBridgeCatalogQuery validates and canonicalizes one public catalog query.

type BridgeCatalogRecord

type BridgeCatalogRecord struct {
	ID              string
	ProfileID       string
	ProfileName     string
	ProfileColor    string
	ProfileIcon     string
	ProfileEmoji    string
	ProfileArchived bool
	Scope           Scope
	WorkspaceID     string
	Platform        string
	ExtensionName   string
	DisplayName     string
	Enabled         bool
	Status          BridgeStatus
}

BridgeCatalogRecord is the lean persisted projection used before page hydration.

func BridgeCatalogRecordFromInstance

func BridgeCatalogRecordFromInstance(instance BridgeInstance) BridgeCatalogRecord

BridgeCatalogRecordFromInstance projects one full instance into catalog-only metadata.

func (BridgeCatalogRecord) Normalized

Normalized returns the canonical catalog record representation.

func (BridgeCatalogRecord) Validate

func (r BridgeCatalogRecord) Validate() error

Validate reports whether the lean projection contains every catalog-owned field.

type BridgeCatalogRecordItem

type BridgeCatalogRecordItem struct {
	Record          BridgeCatalogRecord
	EffectiveStatus BridgeStatus
}

BridgeCatalogRecordItem combines lean persisted metadata with effective runtime status.

type BridgeCatalogRecordPage

type BridgeCatalogRecordPage struct {
	Items      []BridgeCatalogRecordItem
	Facets     BridgeCatalogFacets
	NextCursor string
	HasMore    bool
	Total      int
	Limit      int
}

BridgeCatalogRecordPage is the stable page cut before full instance hydration.

func BuildBridgeCatalogRecordPage

func BuildBridgeCatalogRecordPage(
	records []BridgeCatalogRecord,
	effectiveStatuses map[string]BridgeStatus,
	query BridgeCatalogQuery,
) (BridgeCatalogRecordPage, error)

BuildBridgeCatalogRecordPage filters lean metadata before selecting full rows to hydrate.

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. Provider response bodies and raw errors are deliberately absent from this contract.

func (BridgeCheckRecord) Validate

func (r BridgeCheckRecord) Validate() error

Validate enforces a named, closed, actionable provider check result.

type BridgeCheckRequest

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

BridgeCheckRequest selects the daemon-owned bridge 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 explicit 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 one provider check.

func (BridgeCheckStatus) Validate

func (s BridgeCheckStatus) Validate() error

Validate enforces the closed public check status family.

type BridgeControlTransport

type BridgeControlTransport interface {
	CheckBridge(
		ctx context.Context,
		extensionName string,
		req BridgeCheckRequest,
	) (BridgeCheckResponse, error)
	RegisterBridgeWebhook(
		ctx context.Context,
		extensionName string,
		req BridgeWebhookRegistrationRequest,
	) (BridgeWebhookRegistrationResponse, error)
}

BridgeControlTransport executes provider-owned control calls through isolated extension runtimes.

type BridgeDMPolicy

type BridgeDMPolicy string

BridgeDMPolicy controls how direct messages from unpaired senders are handled.

const (
	// BridgeDMPolicyOpen accepts direct messages from any sender.
	BridgeDMPolicyOpen BridgeDMPolicy = BridgeDMPolicy(bridgecontract.BridgeDMPolicyOpen)
	// BridgeDMPolicyAllowlist accepts direct messages only from approved senders.
	BridgeDMPolicyAllowlist BridgeDMPolicy = BridgeDMPolicy(bridgecontract.BridgeDMPolicyAllowlist)
	// BridgeDMPolicyPairing accepts pre-populated paired identities, then falls back to the allowlist.
	BridgeDMPolicyPairing BridgeDMPolicy = BridgeDMPolicy(bridgecontract.BridgeDMPolicyPairing)
)

func (BridgeDMPolicy) Normalize

func (p BridgeDMPolicy) Normalize() BridgeDMPolicy

Normalize returns the normalized representation of the DM policy.

func (BridgeDMPolicy) Validate

func (p BridgeDMPolicy) Validate() error

Validate reports whether the DM policy belongs to the supported bridge v1 set.

type BridgeDegradation

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

BridgeDegradation captures the structured degradation metadata persisted for a bridge instance.

func (BridgeDegradation) IsZero

func (d BridgeDegradation) IsZero() bool

IsZero reports whether the degradation payload carries any values.

func (BridgeDegradation) Validate

func (d BridgeDegradation) Validate() error

Validate reports whether the degradation payload is internally consistent.

type BridgeDegradationReason

type BridgeDegradationReason string

BridgeDegradationReason reports the structured operational cause for a degraded bridge instance.

func (BridgeDegradationReason) Normalize

Normalize returns the normalized representation of the degradation reason.

func (BridgeDegradationReason) Validate

func (r BridgeDegradationReason) Validate() error

Validate reports whether the degradation reason belongs to the supported bridge v1 set.

type BridgeDeliveryMetrics

type BridgeDeliveryMetrics struct {
	BridgeInstanceID        string         `json:"bridge_instance_id"`
	ProfileID               string         `json:"profile_id"`
	ProfileName             string         `json:"profile_name,omitempty"`
	ProfileColor            string         `json:"profile_color,omitempty"`
	ProfileIcon             string         `json:"profile_icon,omitempty"`
	ProfileEmoji            string         `json:"profile_emoji,omitempty"`
	ProfileArchived         bool           `json:"profile_archived,omitempty"`
	DeliveryBacklog         int            `json:"delivery_backlog"`
	DeliveryDroppedTotal    int            `json:"delivery_dropped_total"`
	DeliveryDroppedByReason map[string]int `json:"delivery_dropped_by_reason,omitempty"`
	DeliveryFailuresTotal   int            `json:"delivery_failures_total"`
	LastError               string         `json:"last_error,omitempty"`
	LastErrorAt             time.Time      `json:"last_error_at"`
	LastSuccessAt           time.Time      `json:"last_success_at"`
}

BridgeDeliveryMetrics captures the per-instance delivery telemetry exposed by the broker for observability surfaces.

type BridgeDiagnostic

type BridgeDiagnostic struct {
	Kind              BridgeDiagnosticKind     `json:"kind"`
	Severity          BridgeDiagnosticSeverity `json:"severity"`
	Source            string                   `json:"source"`
	Message           string                   `json:"message"`
	NextAction        string                   `json:"next_action,omitempty"`
	BridgeInstanceID  string                   `json:"bridge_instance_id,omitempty"`
	SecretSlot        string                   `json:"secret_slot,omitempty"`
	Status            BridgeStatus             `json:"status,omitempty"`
	DegradationReason BridgeDegradationReason  `json:"degradation_reason,omitempty"`
}

BridgeDiagnostic exposes a bridge management diagnostic derived from canonical bridge route, provider, secret, status, degradation, and delivery telemetry.

func BuildBridgeDiagnostics

func BuildBridgeDiagnostics(input BridgeDiagnosticsInput) []BridgeDiagnostic

BuildBridgeDiagnostics derives actionable bridge diagnostics from existing canonical bridge facts.

type BridgeDiagnosticKind

type BridgeDiagnosticKind string

BridgeDiagnosticKind identifies one operator-actionable bridge diagnostic.

const (
	// BridgeDiagnosticKindUnknownDestination reports that no route/default target
	// can identify where outbound delivery should go.
	BridgeDiagnosticKindUnknownDestination BridgeDiagnosticKind = "unknown_destination"
	// BridgeDiagnosticKindMissingToken reports a required provider secret slot that
	// has no persisted binding.
	BridgeDiagnosticKindMissingToken BridgeDiagnosticKind = "missing_token"
	// BridgeDiagnosticKindPermissionDenied reports auth/permission evidence from
	// bridge status, degradation, or observed delivery auth failures.
	BridgeDiagnosticKindPermissionDenied BridgeDiagnosticKind = "permission_denied"
	// BridgeDiagnosticKindUnsupportedCapability reports a provider/capability shape
	// that cannot support this bridge instance.
	BridgeDiagnosticKindUnsupportedCapability BridgeDiagnosticKind = "unsupported_capability"
	// BridgeDiagnosticKindTransientDeliveryFailure reports delivery failure evidence
	// that should be treated as retryable/transient by operators.
	BridgeDiagnosticKindTransientDeliveryFailure BridgeDiagnosticKind = "transient_delivery_failure"
)

type BridgeDiagnosticSeverity

type BridgeDiagnosticSeverity string

BridgeDiagnosticSeverity identifies how strongly an operator should react to a bridge diagnostic.

const (
	// BridgeDiagnosticSeverityInfo reports informational bridge state.
	BridgeDiagnosticSeverityInfo BridgeDiagnosticSeverity = "info"
	// BridgeDiagnosticSeverityWarning reports degraded but potentially recoverable bridge state.
	BridgeDiagnosticSeverityWarning BridgeDiagnosticSeverity = "warning"
	// BridgeDiagnosticSeverityError reports a bridge state that blocks reliable delivery.
	BridgeDiagnosticSeverityError BridgeDiagnosticSeverity = "error"
)

type BridgeDiagnosticsInput

type BridgeDiagnosticsInput struct {
	Instance                 BridgeInstance
	Provider                 *BridgeProvider
	ProviderCatalogAvailable bool
	SecretBindings           []BridgeSecretBinding
	RouteCount               int
	DeliveryBacklog          int
	DeliveryFailuresTotal    int
	AuthFailuresTotal        int
	LastError                string
}

BridgeDiagnosticsInput carries the existing bridge facts used to derive diagnostics without probing or inventing runtime health.

type BridgeInstance

type BridgeInstance struct {
	ID                   string               `json:"id"`
	ProfileID            string               `json:"profile_id"`
	ProfileName          string               `json:"profile_name,omitempty"`
	ProfileColor         string               `json:"profile_color,omitempty"`
	ProfileIcon          string               `json:"profile_icon,omitempty"`
	ProfileEmoji         string               `json:"profile_emoji,omitempty"`
	ProfileArchived      bool                 `json:"profile_archived,omitempty"`
	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 the authoritative persisted configuration for one bridge adapter instance.

func (BridgeInstance) Normalized

func (i BridgeInstance) Normalized() BridgeInstance

Normalized returns the canonical representation of the bridge instance.

func (BridgeInstance) Validate

func (i BridgeInstance) Validate() error

Validate reports whether the persisted bridge instance shape is complete and valid.

type BridgeInstanceReader

type BridgeInstanceReader interface {
	GetBridgeInstance(ctx context.Context, id string) (BridgeInstance, error)
}

BridgeInstanceReader loads bridge instances for direct adapter delivery.

type BridgeInstanceSource

type BridgeInstanceSource string

BridgeInstanceSource identifies where a persisted bridge instance originated.

const (
	// BridgeInstanceSourceDynamic identifies a regular operator-created bridge instance.
	BridgeInstanceSourceDynamic BridgeInstanceSource = BridgeInstanceSource(bridgecontract.BridgeInstanceSourceDynamic)
	// BridgeInstanceSourcePackage identifies a bridge instance managed by an extension package.
	BridgeInstanceSourcePackage BridgeInstanceSource = BridgeInstanceSource(bridgecontract.BridgeInstanceSourcePackage)
)

func (BridgeInstanceSource) Normalize

Normalize returns the normalized representation of the source.

func (BridgeInstanceSource) Validate

func (s BridgeInstanceSource) Validate() error

Validate reports whether the bridge-instance source is supported.

type BridgeInstanceSpec

type BridgeInstanceSpec struct {
	ProfileID            string                      `json:"profile_id"`
	Scope                Scope                       `json:"scope,omitempty"`
	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"`
	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"`
	SecretSlots          []BridgeSecretSlot          `json:"secret_slots,omitempty"`
	ConfigSchema         *BridgeProviderConfigSchema `json:"config_schema,omitempty"`
}

BridgeInstanceSpec is the canonical desired-state payload for bridge.instance records.

Runtime status, degradation, routes, delivery state, and assigned-instance reporting stay in the bridge runtime store. This spec carries only desired configuration plus provider manifest metadata that must be validated with the provider before persistence.

func BridgeInstanceSpecFromCreateRequest

func BridgeInstanceSpecFromCreateRequest(
	req CreateInstanceRequest,
	now func() time.Time,
) (string, BridgeInstanceSpec, error)

BridgeInstanceSpecFromCreateRequest converts a transport/domain create request into desired resource state.

func BridgeInstanceSpecFromInstance

func BridgeInstanceSpecFromInstance(instance BridgeInstance) BridgeInstanceSpec

BridgeInstanceSpecFromInstance strips bridge-owned operational fields from a bridge instance.

type BridgeProvider

type BridgeProvider struct {
	Platform      string                      `json:"platform"`
	ExtensionName string                      `json:"extension_name"`
	DisplayName   string                      `json:"display_name"`
	Description   string                      `json:"description,omitempty"`
	SecretSlots   []BridgeSecretSlot          `json:"secret_slots,omitempty"`
	ConfigSchema  *BridgeProviderConfigSchema `json:"config_schema,omitempty"`
	Enabled       bool                        `json:"enabled"`
	State         string                      `json:"state"`
	Health        string                      `json:"health"`
	HealthMessage string                      `json:"health_message,omitempty"`
}

BridgeProvider describes one installed bridge-capable extension that can be selected when creating a bridge instance.

type BridgeProviderConfigSchema

type BridgeProviderConfigSchema struct {
	Schema  string `toml:"schema,omitempty"  json:"schema,omitempty"`
	Version string `toml:"version,omitempty" json:"version,omitempty"`
}

BridgeProviderConfigSchema captures static provider config schema hints from provider manifests.

func (BridgeProviderConfigSchema) IsZero

func (h BridgeProviderConfigSchema) IsZero() bool

IsZero reports whether the schema hint carries any values.

func (BridgeProviderConfigSchema) Normalize

Normalize returns the normalized representation of the config schema hint.

func (BridgeProviderConfigSchema) Validate

func (h BridgeProviderConfigSchema) Validate() error

Validate reports whether the config schema hint is internally consistent.

type BridgeProviderLookup

type BridgeProviderLookup func(context.Context, string) (BridgeProvider, bool, error)

BridgeProviderLookup resolves provider-authored bridge manifest metadata for resource validation.

type BridgeRoute

type BridgeRoute struct {
	RoutingKeyHash   string    `json:"routing_key_hash"`
	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"`
	SessionID        string    `json:"session_id"`
	AgentName        string    `json:"agent_name"`
	LastActivityAt   time.Time `json:"last_activity_at"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
}

BridgeRoute persists the canonical routing-key to ACP-session mapping.

func CanonicalizeRoute

func CanonicalizeRoute(instance BridgeInstance, route BridgeRoute) (BridgeRoute, error)

CanonicalizeRoute rebuilds the supplied route identity under the instance's routing policy and computes the expected routing-key hash.

func (BridgeRoute) Canonicalize

func (r BridgeRoute) Canonicalize() (BridgeRoute, error)

Canonicalize normalizes the route and fills the routing-key hash when missing.

func (BridgeRoute) RoutingKey

func (r BridgeRoute) RoutingKey() RoutingKey

RoutingKey returns the canonical routing key represented by the route.

func (BridgeRoute) Validate

func (r BridgeRoute) Validate() error

Validate reports whether the persisted route is complete and internally consistent.

type BridgeSecretBinding

type BridgeSecretBinding struct {
	BridgeInstanceID string    `json:"bridge_instance_id"`
	BindingName      string    `json:"binding_name"`
	SecretRef        string    `json:"secret_ref"`
	Kind             string    `json:"kind"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
}

BridgeSecretBinding binds one named bridge secret slot to a daemon-managed secret reference.

func (BridgeSecretBinding) Validate

func (b BridgeSecretBinding) Validate() error

Validate reports whether the persisted secret binding is complete and valid.

type BridgeSecretSlot

type BridgeSecretSlot struct {
	Name        string `toml:"name"                  json:"name"`
	Description string `toml:"description,omitempty" json:"description,omitempty"`
	Required    bool   `toml:"required,omitempty"    json:"required,omitempty"`
}

BridgeSecretSlot describes one provider-declared secret requirement.

func (BridgeSecretSlot) Normalize

func (s BridgeSecretSlot) Normalize() BridgeSecretSlot

Normalize returns the normalized representation of the secret slot.

func (BridgeSecretSlot) Validate

func (s BridgeSecretSlot) Validate() error

Validate reports whether the secret slot metadata is complete.

type BridgeStatus

type BridgeStatus string

BridgeStatus reports the operator-visible lifecycle state of a bridge instance.

const (
	// BridgeStatusDisabled reports an instance that is intentionally disabled.
	BridgeStatusDisabled BridgeStatus = BridgeStatus(bridgecontract.BridgeStatusDisabled)
	// BridgeStatusStarting reports an instance that is launching or reconnecting.
	BridgeStatusStarting BridgeStatus = BridgeStatus(bridgecontract.BridgeStatusStarting)
	// BridgeStatusReady reports an instance that is healthy and ready to ingest/deliver.
	BridgeStatusReady BridgeStatus = BridgeStatus(bridgecontract.BridgeStatusReady)
	// BridgeStatusDegraded reports an instance that is partially working with known issues.
	BridgeStatusDegraded BridgeStatus = BridgeStatus(bridgecontract.BridgeStatusDegraded)
	// BridgeStatusAuthRequired reports an instance that cannot operate until authentication is refreshed.
	BridgeStatusAuthRequired BridgeStatus = BridgeStatus(bridgecontract.BridgeStatusAuthRequired)
	// BridgeStatusError reports an instance that is unhealthy due to a terminal or repeated fault.
	BridgeStatusError BridgeStatus = BridgeStatus(bridgecontract.BridgeStatusError)
)

func (BridgeStatus) Normalize

func (s BridgeStatus) Normalize() BridgeStatus

Normalize returns the normalized representation of the status.

func (BridgeStatus) Validate

func (s BridgeStatus) Validate() error

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

type BridgeTarget

type BridgeTarget struct {
	BridgeID       string           `json:"bridge_id"`
	CanonicalRoute string           `json:"canonical_route"`
	DisplayName    string           `json:"display_name"`
	Normalized     string           `json:"normalized"`
	TargetType     BridgeTargetType `json:"target_type"`
	Qualifier      string           `json:"qualifier,omitempty"`
	Capabilities   []string         `json:"capabilities"`
	UpdatedAt      time.Time        `json:"updated_at"`
	LastSeenAt     time.Time        `json:"last_seen_at,omitzero"`
}

BridgeTarget is the daemon-normalized persisted directory row.

func (BridgeTarget) Validate

func (t BridgeTarget) Validate() error

Validate reports whether the target row is ready for persistence.

type BridgeTargetPage

type BridgeTargetPage struct {
	Items                   []BridgeTarget `json:"items"`
	Total                   int            `json:"total"`
	LastSuccessfulRefreshAt time.Time      `json:"last_successful_refresh_at,omitzero"`
}

BridgeTargetPage is the persistence-layer page for target directory reads.

type BridgeTargetQuery

type BridgeTargetQuery struct {
	BridgeID        string        `json:"bridge_id"`
	Query           string        `json:"query,omitempty"`
	Limit           int           `json:"limit,omitempty"`
	FreshnessWindow time.Duration `json:"-"`
	GeneratedAt     time.Time     `json:"-"`
}

BridgeTargetQuery filters the persisted target directory for one bridge instance.

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 before daemon-owned normalization.

func (BridgeTargetSnapshot) Validate

func (s BridgeTargetSnapshot) Validate() error

Validate reports whether the adapter snapshot has a stable provider identity.

type BridgeTargetSnapshotRequest

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

BridgeTargetSnapshotRequest asks a bridge-capable extension to enumerate targets for one instance.

func (BridgeTargetSnapshotRequest) Validate

func (r BridgeTargetSnapshotRequest) Validate() error

Validate reports whether the snapshot request identifies a bridge instance.

type BridgeTargetSnapshotResponse

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

BridgeTargetSnapshotResponse carries adapter-enumerated targets back to the daemon.

type BridgeTargetType

type BridgeTargetType string

BridgeTargetType identifies the provider target family used by a bridge adapter.

func (BridgeTargetType) Normalize

func (t BridgeTargetType) Normalize() BridgeTargetType

Normalize returns the canonical target type representation.

func (BridgeTargetType) Validate

func (t BridgeTargetType) Validate() error

Validate reports whether the target type belongs to the supported set.

type BridgeTargetsResult

type BridgeTargetsResult struct {
	BridgeID                string         `json:"bridge_id"`
	Items                   []BridgeTarget `json:"items"`
	Total                   int            `json:"total"`
	CacheStale              bool           `json:"cache_stale"`
	GeneratedAt             time.Time      `json:"generated_at"`
	LastSuccessfulRefreshAt time.Time      `json:"last_successful_refresh_at,omitzero"`
}

BridgeTargetsResult is the service-level target directory response.

type BridgeTaskSubscription

type BridgeTaskSubscription struct {
	SubscriptionID   string                `json:"subscription_id"`
	ProfileID        string                `json:"profile_id"`
	ProfileName      string                `json:"profile_name,omitempty"`
	ProfileColor     string                `json:"profile_color,omitempty"`
	ProfileIcon      string                `json:"profile_icon,omitempty"`
	ProfileEmoji     string                `json:"profile_emoji,omitempty"`
	ProfileArchived  bool                  `json:"profile_archived,omitempty"`
	TaskID           string                `json:"task_id"`
	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"`
	DeliveryMode     DeliveryMode          `json:"delivery_mode"`
	CreatedBy        taskpkg.ActorIdentity `json:"created_by"`
	CreatedAt        time.Time             `json:"created_at"`
	UpdatedAt        time.Time             `json:"updated_at"`
}

BridgeTaskSubscription stores one bridge terminal-notification target for one task.

func (BridgeTaskSubscription) CursorKey

CursorKey returns the fixed cursor identity for this subscription.

func (BridgeTaskSubscription) DeliveryTarget

func (s BridgeTaskSubscription) DeliveryTarget() DeliveryTarget

DeliveryTarget returns the outbound bridge delivery target for the subscription.

func (BridgeTaskSubscription) Normalize

Normalize returns the canonical subscription representation.

func (BridgeTaskSubscription) RoutingKey

func (s BridgeTaskSubscription) RoutingKey() RoutingKey

RoutingKey returns the subscription's bridge routing identity.

func (BridgeTaskSubscription) Validate

func (s BridgeTaskSubscription) Validate() error

Validate reports whether a subscription contains a valid task delivery target.

type BridgeTaskSubscriptionQuery

type BridgeTaskSubscriptionQuery struct {
	ReadScope        store.ReadScope
	TaskID           string `json:"task_id,omitempty"`
	BridgeInstanceID string `json:"bridge_instance_id,omitempty"`
	Scope            Scope  `json:"scope,omitempty"`
	WorkspaceID      string `json:"workspace_id,omitempty"`
	Limit            int    `json:"limit,omitempty"`
}

BridgeTaskSubscriptionQuery filters persisted bridge task subscriptions.

func (BridgeTaskSubscriptionQuery) Normalize

Normalize preserves opaque subscription query filters while normalizing the closed scope enum.

func (BridgeTaskSubscriptionQuery) Validate

func (q BridgeTaskSubscriptionQuery) Validate() error

Validate reports whether the read scope and optional subscription filters retain valid opaque identity components.

type BridgeTaskSubscriptionStore

type BridgeTaskSubscriptionStore interface {
	PutBridgeTaskSubscription(ctx context.Context, subscription BridgeTaskSubscription) error
	GetBridgeTaskSubscription(
		ctx context.Context,
		readScope store.ReadScope,
		subscriptionID string,
	) (BridgeTaskSubscription, error)
	ListBridgeTaskSubscriptions(
		ctx context.Context,
		query BridgeTaskSubscriptionQuery,
	) ([]BridgeTaskSubscription, error)
	DeleteBridgeTaskSubscription(ctx context.Context, subscriptionID string) error
}

BridgeTaskSubscriptionStore persists bridge task subscription targets.

type BridgeWebhookRegistrationRequest

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

BridgeWebhookRegistrationRequest selects the instance whose configured webhook is registered.

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 stable result of provider webhook registration.

func (BridgeWebhookRegistrationResponse) Validate

Validate enforces the same closed, actionable status contract as provider checks.

type Broker

type Broker struct {
	// contains filtered or unexported fields
}

Broker projects session output into ordered delivery requests for one bridge-capable extension runtime.

func NewBroker

func NewBroker(transport DeliveryTransport, opts ...DeliveryBrokerOption) *Broker

NewBroker constructs a delivery broker with bounded per-route queues and background workers for negotiated extension delivery.

func (*Broker) CheckPromptDeliveryAdmission

func (b *Broker) CheckPromptDeliveryAdmission(ctx context.Context) error

CheckPromptDeliveryAdmission rejects prompt side effects until reconciliation completes.

func (*Broker) Close

func (b *Broker) Close()

Close closes mutable admission, stops workers, joins admitted work, and flushes terminal metrics.

func (*Broker) CompleteDeliveryReconciliation

func (b *Broker) CompleteDeliveryReconciliation()

CompleteDeliveryReconciliation admits new prompt-delivery registrations.

func (*Broker) Deliver

func (b *Broker) Deliver(ctx context.Context, evt DeliveryEvent) error

Deliver enqueues one already-projected delivery event for ordered extension delivery.

func (*Broker) DeliveryMetricPersistenceError

func (b *Broker) DeliveryMetricPersistenceError() error

DeliveryMetricPersistenceError returns accumulated durable-metric write failures.

func (*Broker) DeliveryMetrics

func (b *Broker) DeliveryMetrics() map[string]BridgeDeliveryMetrics

DeliveryMetrics returns a point-in-time snapshot of all broker telemetry.

func (*Broker) DeliveryMetricsFor

func (b *Broker) DeliveryMetricsFor(
	bridgeInstanceIDs []string,
) (map[string]BridgeDeliveryMetrics, error)

DeliveryMetricsFor returns telemetry for one bounded set of bridge IDs.

func (*Broker) FailSession

func (b *Broker) FailSession(ctx context.Context, sessionID string, reason string) error

FailSession marks every unfinished delivery for the stopped session as a terminal error so adapters do not silently orphan bridge responses.

func (*Broker) LoadDeliveryMetrics

func (b *Broker) LoadDeliveryMetrics(ctx context.Context, query DeliveryLedgerQuery) error

LoadDeliveryMetrics hydrates one exact durable scope before health surfaces become available.

func (*Broker) ProjectEvent

func (b *Broker) ProjectEvent(ctx context.Context, sessionID string, event DeliveryProjectionEvent) error

ProjectEvent converts one live or persisted session output event into the delivery-oriented stream for the registered prompt turn.

func (*Broker) ReconcileDelivery

func (b *Broker) ReconcileDelivery(
	ctx context.Context,
	record DeliveryLedgerRecord,
	extensionName string,
) error

ReconcileDelivery closes one persisted unfinished delivery. An unmatched send intent is terminalized locally; otherwise the provider receives one write-ahead terminal error post.

func (*Broker) RegisterPromptDelivery

func (b *Broker) RegisterPromptDelivery(
	ctx context.Context,
	reg PromptDeliveryRegistration,
) (*DeliverySnapshot, error)

RegisterPromptDelivery binds one prompted session turn to a live delivery projection and optionally seeds the broker from already-persisted turn events.

func (*Broker) SetTransport

func (b *Broker) SetTransport(transport DeliveryTransport)

SetTransport swaps the negotiated extension-delivery transport used by the broker.

func (*Broker) Snapshot

func (b *Broker) Snapshot(ctx context.Context, deliveryID string) (*DeliverySnapshot, error)

Snapshot returns the current resumable state for one active delivery.

type ControlMethod

type ControlMethod string

ControlMethod identifies one typed provider control operation.

const (
	// ControlMethodCheck asks the adapter to run read-only provider checks.
	ControlMethodCheck ControlMethod = ControlMethod(bridgecontract.ControlMethodCheck)
	// ControlMethodWebhookRegister asks the adapter to register its configured webhook.
	ControlMethodWebhookRegister ControlMethod = ControlMethod(bridgecontract.ControlMethodWebhookRegister)
)

func (ControlMethod) Validate

func (m ControlMethod) Validate() error

Validate enforces the closed provider control method family.

type CreateInstanceRequest

type CreateInstanceRequest struct {
	ID                   string               `json:"id,omitempty"`
	ProfileID            string               `json:"profile_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"`
}

CreateInstanceRequest captures the persisted configuration for a new bridge instance.

func (CreateInstanceRequest) Validate

func (r CreateInstanceRequest) Validate() error

Validate reports whether the creation request contains a valid instance definition.

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"`
	// contains filtered or unexported fields
}

DeliveryAck is the negotiated extension->daemon result for one `bridges/deliver` request.

func (*DeliveryAck) UnmarshalJSON

func (a *DeliveryAck) UnmarshalJSON(data []byte) error

UnmarshalJSON preserves whether the required sequence was explicitly sent. Sequence zero is valid, so the Go zero value cannot distinguish it from an absent or null JSON field without this wire-presence bit.

func (DeliveryAck) ValidateFor

func (a DeliveryAck) ValidateFor(event DeliveryEvent) error

ValidateFor reports whether the acknowledgement still belongs to the request that triggered it.

type DeliveryAckOutcome

type DeliveryAckOutcome string

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

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 DeliveryBrokerOption

type DeliveryBrokerOption func(*Broker)

DeliveryBrokerOption customizes delivery-broker construction.

func WithDeliveryBrokerDescriptorLookup

func WithDeliveryBrokerDescriptorLookup(lookup toolmeta.DescriptorLookup) DeliveryBrokerOption

WithDeliveryBrokerDescriptorLookup resolves registry-owned tool presentation metadata.

func WithDeliveryBrokerLifecycleContext

func WithDeliveryBrokerLifecycleContext(ctx context.Context) DeliveryBrokerOption

WithDeliveryBrokerLifecycleContext injects the broker-owned lifecycle context used by background route workers.

func WithDeliveryBrokerNow

func WithDeliveryBrokerNow(now func() time.Time) DeliveryBrokerOption

WithDeliveryBrokerNow overrides the broker clock, mainly for tests.

func WithDeliveryBrokerQueueCapacity

func WithDeliveryBrokerQueueCapacity(capacity int) DeliveryBrokerOption

WithDeliveryBrokerQueueCapacity overrides the bounded queue length per routed delivery worker. Values below 2 are raised to 2 so `start` and one terminal event can coexist under pressure.

func WithDeliveryBrokerRegistrationGate

func WithDeliveryBrokerRegistrationGate() DeliveryBrokerOption

WithDeliveryBrokerRegistrationGate keeps registrations closed until boot reconciliation completes.

func WithDeliveryBrokerRequestTimeout

func WithDeliveryBrokerRequestTimeout(timeout time.Duration) DeliveryBrokerOption

WithDeliveryBrokerRequestTimeout overrides the timeout applied to one negotiated `bridges/deliver` call.

func WithDeliveryBrokerRetryDelay

func WithDeliveryBrokerRetryDelay(delay time.Duration) DeliveryBrokerOption

WithDeliveryBrokerRetryDelay overrides the backoff between retry attempts after a delivery-transport failure.

func WithDeliveryLedgerStore

func WithDeliveryLedgerStore(store DeliveryLedgerStore) DeliveryBrokerOption

WithDeliveryLedgerStore enables durable registration and acknowledgement checkpoints.

type DeliveryErrorDetail

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

DeliveryErrorDetail captures one typed delivery failure payload.

func (DeliveryErrorDetail) Validate

func (d DeliveryErrorDetail) Validate() error

Validate reports whether the error detail 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 a bridge adapter.

func ProjectAgentEvent

func ProjectAgentEvent(
	event DeliveryProjectionEvent,
	mode ProgressMode,
) (DeliveryEvent, bool, error)

ProjectAgentEvent is the single presentation projection gate used by live and replay delivery paths. The returned event is a template: the broker adds delivery identity, accumulated text, sequence, index, and rendered chrome.

func (DeliveryEvent) IsLifecycleOnlyFinal

func (e DeliveryEvent) IsLifecycleOnlyFinal() bool

IsLifecycleOnlyFinal reports whether the event closes a progress-only POST without materializing or replacing provider message content.

func (DeliveryEvent) Validate

func (e DeliveryEvent) Validate() error

Validate reports whether the delivery event contains the required identifiers.

type DeliveryEventType

type DeliveryEventType string

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

const (
	// DeliveryEventTypeStart starts one progressive outbound delivery for a prompt turn.
	DeliveryEventTypeStart DeliveryEventType = DeliveryEventType(bridgecontract.DeliveryEventTypeStart)
	// DeliveryEventTypeDelta updates one progressive outbound delivery with newer full text.
	DeliveryEventTypeDelta DeliveryEventType = DeliveryEventType(bridgecontract.DeliveryEventTypeDelta)
	// DeliveryEventTypeFinal reports the terminal successful state for one delivery.
	DeliveryEventTypeFinal DeliveryEventType = DeliveryEventType(bridgecontract.DeliveryEventTypeFinal)
	// DeliveryEventTypeError reports the terminal failed state for one delivery.
	DeliveryEventTypeError DeliveryEventType = DeliveryEventType(bridgecontract.DeliveryEventTypeError)
	// DeliveryEventTypeResume rehydrates the latest delivery snapshot after adapter recovery.
	DeliveryEventTypeResume DeliveryEventType = DeliveryEventType(bridgecontract.DeliveryEventTypeResume)
	// DeliveryEventTypeDelete removes one previously delivered message.
	DeliveryEventTypeDelete DeliveryEventType = DeliveryEventType(bridgecontract.DeliveryEventTypeDelete)
	// DeliveryEventTypeProgress carries presentation-only tool lifecycle chrome.
	DeliveryEventTypeProgress DeliveryEventType = DeliveryEventType(bridgecontract.DeliveryEventTypeProgress)
)

type DeliveryLedgerCheckpoint

type DeliveryLedgerCheckpoint struct {
	DeliveryID      string                `json:"delivery_id"`
	State           DeliveryLedgerState   `json:"state"`
	LastSentSeq     int64                 `json:"last_sent_seq"`
	LastAckedSeq    int64                 `json:"last_acked_seq"`
	RemoteMessageID string                `json:"remote_message_id,omitempty"`
	TerminalError   string                `json:"terminal_error,omitempty"`
	UpdatedAt       time.Time             `json:"updated_at"`
	Metrics         *DeliveryMetricRecord `json:"metrics,omitempty"`
}

DeliveryLedgerCheckpoint advances an existing durable delivery without reidentifying it.

func (DeliveryLedgerCheckpoint) Canonicalize

Canonicalize normalizes and validates one delivery checkpoint.

func (DeliveryLedgerCheckpoint) Validate

func (c DeliveryLedgerCheckpoint) Validate() error

Validate reports whether a checkpoint contains a valid monotonic target state.

type DeliveryLedgerQuery

type DeliveryLedgerQuery struct {
	ReadScope        store.ReadScope     `json:"-"`
	Scope            Scope               `json:"scope"`
	WorkspaceID      string              `json:"workspace_id,omitempty"`
	BridgeInstanceID string              `json:"bridge_instance_id,omitempty"`
	State            DeliveryLedgerState `json:"state,omitempty"`
	Limit            int                 `json:"limit,omitempty"`
}

DeliveryLedgerQuery scopes ledger and metric reads without an instance join.

func (DeliveryLedgerQuery) Canonicalize

func (q DeliveryLedgerQuery) Canonicalize() (DeliveryLedgerQuery, error)

Canonicalize normalizes and validates a delivery-ledger query.

func (DeliveryLedgerQuery) Validate

func (q DeliveryLedgerQuery) Validate() error

Validate reports whether a query has one exact global or workspace scope.

type DeliveryLedgerRecord

type DeliveryLedgerRecord struct {
	DeliveryID       string              `json:"delivery_id"`
	ProfileID        string              `json:"profile_id"`
	ProfileName      string              `json:"profile_name,omitempty"`
	ProfileColor     string              `json:"profile_color,omitempty"`
	ProfileIcon      string              `json:"profile_icon,omitempty"`
	ProfileEmoji     string              `json:"profile_emoji,omitempty"`
	ProfileArchived  bool                `json:"profile_archived,omitempty"`
	SessionID        string              `json:"session_id"`
	TurnID           string              `json:"turn_id"`
	RoutingKey       RoutingKey          `json:"routing_key"`
	BridgeInstanceID string              `json:"bridge_instance_id"`
	Scope            Scope               `json:"scope"`
	WorkspaceID      string              `json:"workspace_id,omitempty"`
	State            DeliveryLedgerState `json:"state"`
	LastSentSeq      int64               `json:"last_sent_seq"`
	LastAckedSeq     int64               `json:"last_acked_seq"`
	RemoteMessageID  string              `json:"remote_message_id,omitempty"`
	TerminalError    string              `json:"terminal_error,omitempty"`
	CreatedAt        time.Time           `json:"created_at"`
	UpdatedAt        time.Time           `json:"updated_at"`
}

DeliveryLedgerRecord is the checkpoint-only durable identity and state of one delivery.

func (DeliveryLedgerRecord) Canonicalize

func (r DeliveryLedgerRecord) Canonicalize() (DeliveryLedgerRecord, error)

Canonicalize normalizes and validates a durable delivery record.

func (DeliveryLedgerRecord) Validate

func (r DeliveryLedgerRecord) Validate() error

Validate reports whether a durable delivery record is complete and internally consistent.

type DeliveryLedgerState

type DeliveryLedgerState string

DeliveryLedgerState is the durable lifecycle state of one bridge delivery.

const (
	// DeliveryLedgerStateActive identifies a delivery that still needs reconciliation.
	DeliveryLedgerStateActive DeliveryLedgerState = "active"
	// DeliveryLedgerStateTerminalOK identifies a successfully completed delivery.
	DeliveryLedgerStateTerminalOK DeliveryLedgerState = "terminal_ok"
	// DeliveryLedgerStateTerminalError identifies a delivery completed with an error.
	DeliveryLedgerStateTerminalError DeliveryLedgerState = "terminal_error"
)

func (DeliveryLedgerState) Normalize

Normalize returns the canonical delivery-ledger state.

func (DeliveryLedgerState) Validate

func (s DeliveryLedgerState) Validate() error

Validate reports whether the delivery-ledger state is supported.

type DeliveryLedgerStore

type DeliveryLedgerStore interface {
	CreateBridgeDelivery(ctx context.Context, record DeliveryLedgerRecord) error
	CheckpointBridgeDelivery(ctx context.Context, checkpoint DeliveryLedgerCheckpoint) error
	ListBridgeDeliveries(ctx context.Context, query DeliveryLedgerQuery) ([]DeliveryLedgerRecord, error)
	ListBridgeDeliveryMetrics(ctx context.Context, query DeliveryLedgerQuery) (map[string]BridgeDeliveryMetrics, error)
	PutBridgeDeliveryMetrics(ctx context.Context, record DeliveryMetricRecord) error
}

DeliveryLedgerStore persists checkpoint-only delivery state and durable counters.

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 (DeliveryMessageReference) Validate

func (r DeliveryMessageReference) Validate() error

Validate reports whether the reference identifies at least one prior message handle.

type DeliveryMetricRecord

type DeliveryMetricRecord struct {
	BridgeDeliveryMetrics
	Scope       Scope     `json:"scope"`
	WorkspaceID string    `json:"workspace_id,omitempty"`
	UpdatedAt   time.Time `json:"updated_at"`
}

DeliveryMetricRecord binds durable broker counters to one direct scope identity.

func (DeliveryMetricRecord) Canonicalize

func (r DeliveryMetricRecord) Canonicalize() (DeliveryMetricRecord, error)

Canonicalize normalizes and validates one durable metric snapshot.

func (DeliveryMetricRecord) Validate

func (r DeliveryMetricRecord) Validate() error

Validate reports whether durable delivery metrics are complete and internally consistent.

type DeliveryMode

type DeliveryMode string

DeliveryMode identifies the daemon-owned outbound delivery behavior requested for one canonical bridge target.

const (
	// DeliveryModeDirectSend sends a fresh outbound message into the target conversation.
	DeliveryModeDirectSend DeliveryMode = DeliveryMode(bridgecontract.DeliveryModeDirectSend)
	// DeliveryModeReply sends an outbound reply within the resolved conversation context.
	DeliveryModeReply DeliveryMode = DeliveryMode(bridgecontract.DeliveryModeReply)
)

func (DeliveryMode) Validate

func (m DeliveryMode) Validate() error

Validate reports whether the delivery mode belongs to the supported mode set.

type DeliveryOperation

type DeliveryOperation string

DeliveryOperation identifies whether the outbound delivery is posting new text, editing an existing remote message, or deleting one.

const (
	// DeliveryOperationPost creates or continues a new daemon-owned delivery.
	DeliveryOperationPost DeliveryOperation = DeliveryOperation(bridgecontract.DeliveryOperationPost)
	// DeliveryOperationEdit updates a previously delivered message in-place.
	DeliveryOperationEdit DeliveryOperation = DeliveryOperation(bridgecontract.DeliveryOperationEdit)
	// DeliveryOperationDelete removes a previously delivered message.
	DeliveryOperationDelete DeliveryOperation = DeliveryOperation(bridgecontract.DeliveryOperationDelete)
)

func (DeliveryOperation) Normalize

func (o DeliveryOperation) Normalize() DeliveryOperation

Normalize returns the canonical delivery-operation representation.

func (DeliveryOperation) Validate

func (o DeliveryOperation) Validate() error

Validate reports whether the delivery operation belongs to the supported set.

type DeliveryProjectionEvent

type DeliveryProjectionEvent struct {
	Type         string                      `json:"type"`
	TurnID       string                      `json:"turn_id"`
	Timestamp    time.Time                   `json:"timestamp"`
	Text         string                      `json:"text,omitempty"`
	Error        string                      `json:"error,omitempty"`
	Fingerprint  string                      `json:"fingerprint,omitempty"`
	Tool         *ToolProgress               `json:"tool,omitempty"`
	ToolInput    json.RawMessage             `json:"-"`
	ToolMetadata toolmeta.DescriptorMetadata `json:"-"`
}

DeliveryProjectionEvent is the reduced session-event shape the broker needs to project prompt output into delivery-oriented bridge events. It remains ACP-agnostic so `internal/bridges` does not depend on runtime transport packages.

type DeliveryRequest

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

DeliveryRequest is the negotiated daemon->extension request payload for `bridges/deliver`. Regular streaming requests carry only Event. Recovery requests also carry Snapshot and use EventTypeResume.

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 typed resumable delivery phase.

func (DeliveryResumeState) Validate

func (s DeliveryResumeState) Validate() error

Validate reports whether the resume state references a supported prior event type.

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 the current progressive state for one active delivery so the broker can resume it after adapter recovery.

func (DeliverySnapshot) Validate

func (s DeliverySnapshot) Validate() error

Validate reports whether the snapshot contains the state needed to resume a negotiated bridge 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 delivery destination within one bridge instance.

func BuildDeliveryTarget

func BuildDeliveryTarget(instance BridgeInstance, req ResolveDeliveryTargetRequest) (DeliveryTarget, error)

BuildDeliveryTarget merges bridge-instance delivery defaults with explicit request overrides and returns one canonical outbound target.

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 delivery target contains a supported mode and the identity fields required by that mode.

type DeliveryTransport

type DeliveryTransport interface {
	DeliverBridge(ctx context.Context, extensionName string, req DeliveryRequest) (DeliveryAck, error)
}

DeliveryTransport delivers negotiated daemon->extension bridge requests. The extension name remains explicit because the broker owns routing semantics, while the extension manager owns the subprocess runtime.

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 typed button/action inbound interaction.

func (InboundAction) Validate

func (a InboundAction) Validate() error

Validate reports whether the action payload contains the required identity.

type InboundCommand

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

InboundCommand captures a typed slash-command style inbound interaction.

func (InboundCommand) Validate

func (c InboundCommand) Validate() error

Validate reports whether the command payload contains the required identity.

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 one typed update or deletion of an existing platform message.

func (InboundEdit) Validate

func (e InboundEdit) Validate() error

Validate reports whether the edit carries an unambiguous operation payload.

type InboundEditOperation

type InboundEditOperation string

InboundEditOperation distinguishes replacement text from message deletion.

const (
	// InboundEditOperationUpdated replaces the existing message text.
	InboundEditOperationUpdated InboundEditOperation = InboundEditOperation(bridgecontract.InboundEditOperationUpdated)
	// InboundEditOperationDeleted removes the existing message.
	InboundEditOperationDeleted InboundEditOperation = InboundEditOperation(bridgecontract.InboundEditOperationDeleted)
)

func (InboundEditOperation) Normalize

Normalize returns the canonical inbound edit operation.

func (InboundEditOperation) Validate

func (o InboundEditOperation) Validate() error

Validate reports whether the edit operation belongs to the supported set.

type InboundEventFamily

type InboundEventFamily string

InboundEventFamily identifies the typed inbound bridge event family.

const (
	// InboundEventFamilyMessage identifies a text-and-attachment message event.
	InboundEventFamilyMessage InboundEventFamily = InboundEventFamily(bridgecontract.InboundEventFamilyMessage)
	// InboundEventFamilyCommand identifies a typed slash-command style event.
	InboundEventFamilyCommand InboundEventFamily = InboundEventFamily(bridgecontract.InboundEventFamilyCommand)
	// InboundEventFamilyAction identifies a typed button/action event.
	InboundEventFamilyAction InboundEventFamily = InboundEventFamily(bridgecontract.InboundEventFamilyAction)
	// InboundEventFamilyReaction identifies a typed reaction add/remove event.
	InboundEventFamilyReaction InboundEventFamily = InboundEventFamily(bridgecontract.InboundEventFamilyReaction)
	// InboundEventFamilyEdit identifies an update or deletion of an existing message.
	InboundEventFamilyEdit InboundEventFamily = InboundEventFamily(bridgecontract.InboundEventFamilyEdit)
)

func (InboundEventFamily) Normalize

func (f InboundEventFamily) Normalize() InboundEventFamily

Normalize returns the canonical inbound event-family representation.

func (InboundEventFamily) Validate

func (f InboundEventFamily) Validate() error

Validate reports whether the inbound event family belongs to the supported set.

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 delivered by adapters.

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 contains the required identifying fields.

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 typed reaction add/remove inbound interaction.

func (InboundReaction) Validate

func (r InboundReaction) Validate() error

Validate reports whether the reaction payload contains the required identity.

type IngestDedupRecord

type IngestDedupRecord struct {
	IdempotencyKey   string    `json:"idempotency_key"`
	BridgeInstanceID string    `json:"bridge_instance_id"`
	ReceivedAt       time.Time `json:"received_at"`
	ExpiresAt        time.Time `json:"expires_at"`
}

IngestDedupRecord tracks inbound idempotency keys with an explicit TTL.

func (IngestDedupRecord) Validate

func (r IngestDedupRecord) Validate() error

Validate reports whether the dedup record is complete and time-consistent.

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 shared by ingest and delivery flows.

type MessageContent

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

MessageContent carries normalized text content shared by inbound and outbound bridge models.

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 an inbound 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 (NetworkConversationRef) Validate

func (r NetworkConversationRef) Validate() error

Validate reports whether the explicit bridge mapping selects one Compozy conversation container.

type NetworkConversationSurface

type NetworkConversationSurface string

NetworkConversationSurface identifies one explicit Compozy network conversation container.

const (
	// NetworkConversationSurfaceThread maps bridge ingress into a public Compozy thread.
	NetworkConversationSurfaceThread NetworkConversationSurface = NetworkConversationSurface(
		bridgecontract.NetworkConversationSurfaceThread,
	)
	// NetworkConversationSurfaceDirect maps bridge ingress into a resolved Compozy direct room.
	NetworkConversationSurfaceDirect NetworkConversationSurface = NetworkConversationSurface(
		bridgecontract.NetworkConversationSurfaceDirect,
	)
)

func (NetworkConversationSurface) Normalize

Normalize returns the canonical bridge conversation surface.

type PlatformDimensionMapping

type PlatformDimensionMapping struct {
	Platform        string `json:"platform"`
	PeerIDConcept   string `json:"peer_id_concept,omitempty"`
	ThreadIDConcept string `json:"thread_id_concept,omitempty"`
	GroupIDConcept  string `json:"group_id_concept,omitempty"`
}

PlatformDimensionMapping documents how one adapter maps platform-native identity concepts onto Compozy's canonical routing dimensions.

Semantics: - `peer_id` identifies the direct conversation peer or primary counterparty. - `thread_id` identifies a sub-conversation nested under a peer or group. - `group_id` identifies a shared container such as a room, forum, bridge, or guild.

Adapters should publish one mapping per platform so route inspection and cross-platform tooling can interpret `peer_id`, `thread_id`, and `group_id` consistently.

func (PlatformDimensionMapping) Validate

func (m PlatformDimensionMapping) Validate() error

Validate reports whether the contract identifies a platform and at least one mapped routing dimension concept.

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 typed effective bridge progress configuration.

func ResolveProgressConfig

func ResolveProgressConfig(instance *BridgeInstance, platform string) ProgressConfig

ResolveProgressConfig applies instance override, then platform, then global defaults.

func (ProgressConfig) Validate

func (c ProgressConfig) Validate() error

Validate reports whether all public progress settings are supported.

type ProgressGrouping

type ProgressGrouping string

ProgressGrouping controls whether progress lines accumulate or post separately.

func (ProgressGrouping) Normalize

func (g ProgressGrouping) Normalize() ProgressGrouping

Normalize returns the canonical grouping representation.

func (ProgressGrouping) Validate

func (g ProgressGrouping) Validate() error

Validate reports whether the grouping belongs to the supported set.

type ProgressMode

type ProgressMode string

ProgressMode controls which tool lifecycle events become bridge presentation events.

func (ProgressMode) Normalize

func (m ProgressMode) Normalize() ProgressMode

Normalize returns the canonical progress-mode representation.

func (ProgressMode) Validate

func (m ProgressMode) Validate() error

Validate reports whether the mode belongs to the supported progress taxonomy.

type PromptDeliveryRegistration

type PromptDeliveryRegistration struct {
	SessionID      string                    `json:"session_id"`
	TurnID         string                    `json:"turn_id"`
	ExtensionName  string                    `json:"extension_name"`
	DeliveryID     string                    `json:"delivery_id,omitempty"`
	RoutingKey     RoutingKey                `json:"routing_key"`
	DeliveryTarget DeliveryTarget            `json:"delivery_target"`
	Progress       ProgressConfig            `json:"progress"`
	SeedEvents     []DeliveryProjectionEvent `json:"seed_events,omitempty"`
}

PromptDeliveryRegistration binds one session prompt turn to a routed bridge delivery stream before or shortly after the prompt begins emitting events.

func (PromptDeliveryRegistration) Validate

func (r PromptDeliveryRegistration) Validate() error

Validate reports whether the registration contains enough routed context to project session output into a negotiated delivery stream.

type Registry

type Registry interface {
	CreateInstance(ctx context.Context, req CreateInstanceRequest) (*BridgeInstance, error)
	GetInstance(ctx context.Context, id string) (*BridgeInstance, error)
	GetInstanceScoped(ctx context.Context, readScope store.ReadScope, id string) (*BridgeInstance, error)
	ListInstances(ctx context.Context) ([]BridgeInstance, error)
	ListInstancesScoped(ctx context.Context, readScope store.ReadScope) ([]BridgeInstance, error)
	ListCatalogRecords(ctx context.Context, query BridgeCatalogQuery) ([]BridgeCatalogRecord, error)
	ListInstancesByIDs(ctx context.Context, bridgeInstanceIDs []string) ([]BridgeInstance, error)
	ListInstancesByIDsScoped(
		ctx context.Context,
		readScope store.ReadScope,
		bridgeInstanceIDs []string,
	) ([]BridgeInstance, error)
	UpdateInstance(ctx context.Context, req UpdateInstanceRequest) (*BridgeInstance, error)
	UpdateInstanceState(ctx context.Context, req UpdateInstanceStateRequest) (*BridgeInstance, error)
	BuildRoutingKey(ctx context.Context, key RoutingKey) (RoutingKey, error)
	ResolveRoute(ctx context.Context, key RoutingKey) (*BridgeRoute, error)
	ResolveOrCreateRoute(ctx context.Context, route BridgeRoute) (*BridgeRoute, bool, error)
	UpsertRoute(ctx context.Context, route BridgeRoute) (*BridgeRoute, error)
	ListRoutes(ctx context.Context, bridgeInstanceID string) ([]BridgeRoute, error)
	ListRoutesScoped(
		ctx context.Context,
		readScope store.ReadScope,
		bridgeInstanceID string,
	) ([]BridgeRoute, error)
}

Registry owns bridge lifecycle validation and canonical routing-key construction.

type RegistryOption

type RegistryOption func(*Service)

RegistryOption customizes Service construction.

func WithNow

func WithNow(now func() time.Time) RegistryOption

WithNow overrides the clock used for default timestamps in tests.

type RegistryStore

type RegistryStore interface {
	InsertBridgeInstance(ctx context.Context, instance BridgeInstance) error
	UpdateBridgeInstance(ctx context.Context, instance BridgeInstance) error
	GetBridgeInstance(ctx context.Context, readScope store.ReadScope, id string) (BridgeInstance, error)
	ListBridgeInstances(ctx context.Context, readScope store.ReadScope) ([]BridgeInstance, error)
	ListBridgeCatalogRecords(ctx context.Context, query BridgeCatalogQuery) ([]BridgeCatalogRecord, error)
	ListBridgeInstancesByIDs(
		ctx context.Context,
		readScope store.ReadScope,
		bridgeInstanceIDs []string,
	) ([]BridgeInstance, error)
	PutBridgeRoute(ctx context.Context, route BridgeRoute) error
	ResolveBridgeRoute(ctx context.Context, key RoutingKey) (BridgeRoute, error)
	ListBridgeRoutes(
		ctx context.Context,
		readScope store.ReadScope,
		bridgeInstanceID string,
	) ([]BridgeRoute, error)
}

RegistryStore is the persistence surface consumed by the daemon-owned registry.

type ResolveBridgeTargetResult

type ResolveBridgeTargetResult struct {
	Match      *BridgeTarget  `json:"match,omitempty"`
	Step       int            `json:"step"`
	Ambiguous  bool           `json:"ambiguous"`
	Candidates []BridgeTarget `json:"candidates,omitempty"`
}

ResolveBridgeTargetResult reports the deterministic resolver step for one friendly target lookup.

type ResolveDeliveryTargetRequest

type ResolveDeliveryTargetRequest 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"`
}

ResolveDeliveryTargetRequest captures one outbound target request before bridge-instance defaults have been merged in.

func (ResolveDeliveryTargetRequest) Validate

func (r ResolveDeliveryTargetRequest) Validate() error

Validate reports whether the request carries valid opaque identities and an exact supported mode when one is explicitly supplied.

type ResourceProjectionPlan

type ResourceProjectionPlan struct {
	// contains filtered or unexported fields
}

ResourceProjectionPlan is the validated bridge.instance delta built from canonical resources.

func BuildResourceState

func BuildResourceState(
	ctx context.Context,
	store ResourceProjectionStore,
	records []resources.Record[BridgeInstanceSpec],
	now func() time.Time,
) (*ResourceProjectionPlan, error)

BuildResourceState computes the next bridge runtime projection without opening live provider connections.

func (*ResourceProjectionPlan) ChangedExtensions

func (p *ResourceProjectionPlan) ChangedExtensions() []string

ChangedExtensions returns the provider extensions impacted by this plan.

func (*ResourceProjectionPlan) Kind

Kind returns the projected resource kind.

func (*ResourceProjectionPlan) NextInstances

func (p *ResourceProjectionPlan) NextInstances() []BridgeInstance

NextInstances returns the daemon-visible bridge state after this plan applies.

func (*ResourceProjectionPlan) OperationCount

func (p *ResourceProjectionPlan) OperationCount() int

OperationCount returns the number of runtime rows that change when this plan applies.

func (*ResourceProjectionPlan) PreviousInstances

func (p *ResourceProjectionPlan) PreviousInstances() []BridgeInstance

PreviousInstances returns the daemon-visible bridge state before this plan applies.

func (*ResourceProjectionPlan) Revision

func (p *ResourceProjectionPlan) Revision() int64

Revision returns the highest source resource version represented by this plan.

func (*ResourceProjectionPlan) RollbackPlan

RollbackPlan returns a plan that restores the prior daemon-visible bridge state.

type ResourceProjectionStore

type ResourceProjectionStore interface {
	ListBridgeInstances(ctx context.Context, readScope storepkg.ReadScope) ([]BridgeInstance, error)
	ReplaceBridgeInstances(ctx context.Context, instances []BridgeInstance) error
}

ResourceProjectionStore is the bridge desired-runtime surface updated by resource projection. ReplaceBridgeInstances must preserve newer provider-owned operational state when the desired projection still targets the same enabled runtime.

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 the platform-normalized identity values that may participate in a routing key, depending on the instance routing policy.

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 to one ACP session.

func BuildRoutingKey

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

BuildRoutingKey constructs the canonical routing key for one instance using the instance's fixed base identity and policy-selected routing dimensions.

func CanonicalizeRoutingKey

func CanonicalizeRoutingKey(instance BridgeInstance, key RoutingKey) (RoutingKey, error)

CanonicalizeRoutingKey rebuilds the supplied routing key under the instance's routing policy and validates that any supplied base identity matches.

func (RoutingKey) Hash

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

Hash returns the stable SHA-256 hash for the serialized routing key.

func (RoutingKey) Serialize

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

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

func (RoutingKey) Validate

func (k RoutingKey) Validate() error

Validate reports whether the routing key carries the required base identity.

type RoutingPolicy

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

RoutingPolicy controls which platform identity dimensions participate in 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 = Scope(bridgecontract.ScopeGlobal)
	// ScopeWorkspace identifies a workspace-owned bridge resource.
	ScopeWorkspace Scope = Scope(bridgecontract.ScopeWorkspace)
)

func (Scope) Normalize

func (s Scope) Normalize() Scope

Normalize returns the normalized representation of the scope.

func (Scope) Validate

func (s Scope) Validate() error

Validate reports whether the scope is supported.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the concrete daemon-owned registry implementation.

func NewRegistry

func NewRegistry(store RegistryStore, opts ...RegistryOption) *Service

NewRegistry constructs the bridge registry over the supplied persistence surface.

func (*Service) BuildRoutingKey

func (s *Service) BuildRoutingKey(ctx context.Context, key RoutingKey) (RoutingKey, error)

BuildRoutingKey canonicalizes the supplied routing identity under the owning instance policy.

func (*Service) CreateInstance

func (s *Service) CreateInstance(ctx context.Context, req CreateInstanceRequest) (*BridgeInstance, error)

CreateInstance persists a new bridge instance after applying lifecycle validation.

func (*Service) GetInstance

func (s *Service) GetInstance(ctx context.Context, id string) (*BridgeInstance, error)

GetInstance returns one persisted bridge instance by primary key.

func (*Service) GetInstanceScoped

func (s *Service) GetInstanceScoped(
	ctx context.Context,
	readScope store.ReadScope,
	id string,
) (*BridgeInstance, error)

GetInstanceScoped returns one bridge only when it is visible through the explicit profile lens.

func (*Service) ListBridgeTargets

func (s *Service) ListBridgeTargets(ctx context.Context, query BridgeTargetQuery) (BridgeTargetsResult, error)

ListBridgeTargets lists persisted bridge targets and reports cache freshness.

func (*Service) ListCatalogRecords

func (s *Service) ListCatalogRecords(
	ctx context.Context,
	query BridgeCatalogQuery,
) ([]BridgeCatalogRecord, error)

ListCatalogRecords returns the lean persisted authority used before page hydration.

func (*Service) ListInstances

func (s *Service) ListInstances(ctx context.Context) ([]BridgeInstance, error)

ListInstances returns all persisted bridge instances.

func (*Service) ListInstancesByIDs

func (s *Service) ListInstancesByIDs(
	ctx context.Context,
	bridgeInstanceIDs []string,
) ([]BridgeInstance, error)

ListInstancesByIDs returns one bounded instance batch in caller-supplied order.

func (*Service) ListInstancesByIDsScoped

func (s *Service) ListInstancesByIDsScoped(
	ctx context.Context,
	readScope store.ReadScope,
	bridgeInstanceIDs []string,
) ([]BridgeInstance, error)

ListInstancesByIDsScoped returns a bounded bridge batch visible through one explicit profile lens.

func (*Service) ListInstancesScoped

func (s *Service) ListInstancesScoped(ctx context.Context, readScope store.ReadScope) ([]BridgeInstance, error)

ListInstancesScoped returns bridge instances visible through one explicit profile lens.

func (*Service) ListRoutes

func (s *Service) ListRoutes(ctx context.Context, bridgeInstanceID string) ([]BridgeRoute, error)

ListRoutes returns the persisted routes owned by one bridge instance.

func (*Service) ListRoutesScoped

func (s *Service) ListRoutesScoped(
	ctx context.Context,
	readScope store.ReadScope,
	bridgeInstanceID string,
) ([]BridgeRoute, error)

ListRoutesScoped returns bridge routes visible through one explicit profile lens.

func (*Service) RefreshBridgeTargets

func (s *Service) RefreshBridgeTargets(
	ctx context.Context,
	bridgeID string,
	snapshots []BridgeTargetSnapshot,
) ([]BridgeTarget, error)

RefreshBridgeTargets validates adapter snapshots and persists them as one daemon-owned refresh.

func (*Service) ResolveBridgeTarget

func (s *Service) ResolveBridgeTarget(
	ctx context.Context,
	bridgeID string,
	query string,
) (ResolveBridgeTargetResult, error)

ResolveBridgeTarget resolves a canonical bridge target using a deterministic 4-step algorithm.

func (*Service) ResolveDeliveryTarget

func (s *Service) ResolveDeliveryTarget(
	ctx context.Context,
	req ResolveDeliveryTargetRequest,
) (*DeliveryTarget, error)

ResolveDeliveryTarget loads the owning bridge instance and resolves the canonical outbound target under that instance's delivery defaults.

func (*Service) ResolveOrCreateRoute

func (s *Service) ResolveOrCreateRoute(ctx context.Context, route BridgeRoute) (*BridgeRoute, bool, error)

ResolveOrCreateRoute reuses an existing session binding for the canonical key or persists the supplied route when no binding exists yet.

func (*Service) ResolveRoute

func (s *Service) ResolveRoute(ctx context.Context, key RoutingKey) (*BridgeRoute, error)

ResolveRoute resolves one route by canonical routing identity.

func (*Service) UpdateInstance

func (s *Service) UpdateInstance(ctx context.Context, req UpdateInstanceRequest) (*BridgeInstance, error)

UpdateInstance updates one persisted bridge instance without changing its lifecycle state.

func (*Service) UpdateInstanceState

func (s *Service) UpdateInstanceState(ctx context.Context, req UpdateInstanceStateRequest) (*BridgeInstance, error)

UpdateInstanceState applies one validated lifecycle transition to a persisted instance.

func (*Service) UpsertRoute

func (s *Service) UpsertRoute(ctx context.Context, route BridgeRoute) (*BridgeRoute, error)

UpsertRoute writes a route using the canonical key derived from the owning instance policy.

type SlackAppManifest

type SlackAppManifest struct {
	Metadata           SlackManifestMetadata           `json:"_metadata"`
	DisplayInformation SlackManifestDisplayInformation `json:"display_information"`
	Features           SlackManifestFeatures           `json:"features"`
	OAuthConfig        SlackManifestOAuthConfig        `json:"oauth_config"`
	Settings           SlackManifestSettings           `json:"settings"`
}

SlackAppManifest is the webhook-based Slack application artifact generated by Compozy.

func BuildSlackAppManifest

func BuildSlackAppManifest(instance BridgeInstance, provider BridgeProvider) (SlackAppManifest, error)

BuildSlackAppManifest composes one Slack artifact from installed provider and instance metadata.

type SlackManifestBotUser

type SlackManifestBotUser struct {
	DisplayName  string `json:"display_name"`
	AlwaysOnline bool   `json:"always_online"`
}

SlackManifestBotUser configures the installed Slack bot identity.

type SlackManifestDisplayInformation

type SlackManifestDisplayInformation struct {
	Name            string `json:"name"`
	Description     string `json:"description"`
	BackgroundColor string `json:"background_color"`
}

SlackManifestDisplayInformation identifies the app in Slack's catalog and installer.

type SlackManifestEventSubscriptions

type SlackManifestEventSubscriptions struct {
	RequestURL string   `json:"request_url"`
	BotEvents  []string `json:"bot_events"`
}

SlackManifestEventSubscriptions routes subscribed Slack events to Compozy.

type SlackManifestFeatures

type SlackManifestFeatures struct {
	BotUser       SlackManifestBotUser        `json:"bot_user"`
	SlashCommands []SlackManifestSlashCommand `json:"slash_commands"`
}

SlackManifestFeatures declares the bot user and catch-all slash command.

type SlackManifestInteractivity

type SlackManifestInteractivity struct {
	IsEnabled  bool   `json:"is_enabled"`
	RequestURL string `json:"request_url"`
}

SlackManifestInteractivity routes Slack actions to Compozy.

type SlackManifestMetadata

type SlackManifestMetadata struct {
	MajorVersion int `json:"major_version"`
	MinorVersion int `json:"minor_version"`
}

SlackManifestMetadata selects Slack app manifest v1.

type SlackManifestOAuthConfig

type SlackManifestOAuthConfig struct {
	Scopes SlackManifestOAuthScopes `json:"scopes"`
}

SlackManifestOAuthConfig declares the bot scopes installed with the app.

type SlackManifestOAuthScopes

type SlackManifestOAuthScopes struct {
	Bot []string `json:"bot"`
}

SlackManifestOAuthScopes contains the required Slack bot token scopes.

type SlackManifestSettings

type SlackManifestSettings struct {
	EventSubscriptions   SlackManifestEventSubscriptions `json:"event_subscriptions"`
	Interactivity        SlackManifestInteractivity      `json:"interactivity"`
	OrgDeployEnabled     bool                            `json:"org_deploy_enabled"`
	SocketModeEnabled    bool                            `json:"socket_mode_enabled"`
	TokenRotationEnabled bool                            `json:"token_rotation_enabled"`
}

SlackManifestSettings configures webhook delivery and disables Socket Mode.

type SlackManifestSlashCommand

type SlackManifestSlashCommand struct {
	Command      string `json:"command"`
	URL          string `json:"url"`
	Description  string `json:"description"`
	UsageHint    string `json:"usage_hint"`
	ShouldEscape bool   `json:"should_escape"`
}

SlackManifestSlashCommand maps a Slack command to the bridge webhook.

type TargetDirectory

type TargetDirectory interface {
	RefreshBridgeTargets(
		ctx context.Context,
		bridgeID string,
		snapshots []BridgeTargetSnapshot,
	) ([]BridgeTarget, error)
	ListBridgeTargets(ctx context.Context, query BridgeTargetQuery) (BridgeTargetsResult, error)
	ResolveBridgeTarget(ctx context.Context, bridgeID string, query string) (ResolveBridgeTargetResult, error)
}

TargetDirectory is the daemon-owned bridge target directory behavior.

type TargetDirectoryStore

type TargetDirectoryStore interface {
	RefreshBridgeTargets(ctx context.Context, bridgeID string, targets []BridgeTarget, refreshedAt time.Time) error
	ListBridgeTargets(ctx context.Context, query BridgeTargetQuery) (BridgeTargetPage, error)
	GetBridgeTargetByCanonical(ctx context.Context, bridgeID string, canonicalRoute string) (BridgeTarget, error)
	FindBridgeTargetsByNormalized(ctx context.Context, bridgeID string, normalized string) ([]BridgeTarget, error)
	FindBridgeTargetsByQualifiedName(
		ctx context.Context,
		bridgeID string,
		qualifier string,
		normalized string,
	) ([]BridgeTarget, error)
	FindBridgeTargetsByPrefix(ctx context.Context, bridgeID string, normalizedPrefix string) ([]BridgeTarget, error)
}

TargetDirectoryStore is the persistence surface for daemon-owned bridge target refreshes.

type TargetResolver

type TargetResolver interface {
	ResolveDeliveryTarget(ctx context.Context, req ResolveDeliveryTargetRequest) (*DeliveryTarget, error)
}

TargetResolver resolves one canonical outbound delivery target from bridge instance metadata plus explicit destination overrides.

type TargetSnapshotTransport

type TargetSnapshotTransport interface {
	BridgeTargetSnapshots(
		ctx context.Context,
		extensionName string,
		req BridgeTargetSnapshotRequest,
	) ([]BridgeTargetSnapshot, error)
}

TargetSnapshotTransport calls bridge-capable extension adapters for target snapshots.

type TerminalTaskEventReader

type TerminalTaskEventReader interface {
	GetTask(ctx context.Context, id string) (taskpkg.Task, error)
	GetTaskRun(ctx context.Context, id string) (taskpkg.Run, error)
	ListTaskEventRecords(ctx context.Context, query taskpkg.EventRecordQuery) ([]taskpkg.EventRecord, error)
}

TerminalTaskEventReader reads the durable task state used to replay terminal notifications.

type TerminalTaskNotification

type TerminalTaskNotification struct {
	DeliveryID     string          `json:"delivery_id"`
	EventType      string          `json:"event_type"`
	Final          bool            `json:"final"`
	Seq            int64           `json:"seq"`
	TaskID         string          `json:"task_id"`
	RunID          string          `json:"run_id,omitempty"`
	Status         taskpkg.Status  `json:"status"`
	Summary        string          `json:"summary,omitempty"`
	Error          string          `json:"error,omitempty"`
	Payload        json.RawMessage `json:"payload,omitempty"`
	SubscriptionID string          `json:"subscription_id"`
}

TerminalTaskNotification is the bridge-delivered accepted-final task envelope.

type TerminalTaskNotificationSweep

type TerminalTaskNotificationSweep struct {
	Subscriptions int `json:"subscriptions"`
	Delivered     int `json:"delivered"`
	Suppressed    int `json:"suppressed"`
	Deferred      int `json:"deferred"`
	Failed        int `json:"failed"`
}

TerminalTaskNotificationSweep summarizes one notifier replay pass.

type TerminalTaskNotifier

type TerminalTaskNotifier struct {
	// contains filtered or unexported fields
}

TerminalTaskNotifier replays durable task events into subscribed bridge targets.

func NewTerminalTaskNotifier

func NewTerminalTaskNotifier(cfg TerminalTaskNotifierConfig) *TerminalTaskNotifier

NewTerminalTaskNotifier constructs a bridge terminal notifier.

func (*TerminalTaskNotifier) DeliverDue

DeliverDue replays task events for subscriptions matching the query.

type TerminalTaskNotifierConfig

type TerminalTaskNotifierConfig struct {
	Subscriptions BridgeTaskSubscriptionStore
	TaskEvents    TerminalTaskEventReader
	Instances     BridgeInstanceReader
	Cursors       notifications.CursorStore
	Transport     DeliveryTransport
	Now           func() time.Time
	EventLimit    int
}

TerminalTaskNotifierConfig wires the bridge terminal notifier.

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 the presentation-only tool lifecycle payload delivered to adapters.

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 sent to bridge adapters.

func (ToolProgressPhase) Normalize

func (p ToolProgressPhase) Normalize() ToolProgressPhase

Normalize returns the canonical lifecycle phase.

func (ToolProgressPhase) Validate

func (p ToolProgressPhase) Validate() error

Validate reports whether the phase belongs to the bridge progress contract.

type UpdateInstanceRequest

type UpdateInstanceRequest struct {
	ID                   string             `json:"id"`
	DisplayName          *string            `json:"display_name,omitempty"`
	DMPolicy             *BridgeDMPolicy    `json:"dm_policy,omitempty"`
	RoutingPolicy        *RoutingPolicy     `json:"routing_policy,omitempty"`
	ProviderConfig       *json.RawMessage   `json:"provider_config,omitempty"`
	DeliveryDefaults     *json.RawMessage   `json:"delivery_defaults,omitempty"`
	NotificationSuppress *bool              `json:"notification_suppress,omitempty"`
	Degradation          *BridgeDegradation `json:"degradation,omitempty"`
	ClearDegradation     bool               `json:"clear_degradation,omitempty"`
	UpdatedAt            time.Time          `json:"updated_at"`
}

UpdateInstanceRequest captures one mutation of bridge-instance fields that do not change the lifecycle state machine.

func (UpdateInstanceRequest) Validate

func (r UpdateInstanceRequest) Validate() error

Validate reports whether the request contains at least one mutable field and each supplied value is internally consistent.

type UpdateInstanceStateRequest

type UpdateInstanceStateRequest struct {
	ID               string             `json:"id"`
	Enabled          bool               `json:"enabled"`
	Status           BridgeStatus       `json:"status"`
	Degradation      *BridgeDegradation `json:"degradation,omitempty"`
	ClearDegradation bool               `json:"clear_degradation,omitempty"`
	UpdatedAt        time.Time          `json:"updated_at"`
}

UpdateInstanceStateRequest captures one daemon-owned lifecycle transition.

func (UpdateInstanceStateRequest) Validate

func (r UpdateInstanceStateRequest) Validate() error

Validate reports whether the request contains the fields needed for a lifecycle update.

Directories

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

Jump to

Keyboard shortcuts

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