Versions in this module Expand all Collapse all v1 v1.4.0 Oct 20, 2026 Changes in this version + const CapabilityReceive + const CapabilitySend + const CapabilitySignal + var ErrCapabilityDenied = errors.New("ipc: capability denied") + var ErrCrossNamespaceDenied = errors.New("ipc: cross-namespace communication denied by policy") + var ErrCrossTenantDenied = errors.New("ipc: cross-tenant communication denied") + var ErrDuplicateMessage = errors.New("ipc: duplicate message id") + var ErrFenced = errors.New("ipc: agent instance is fenced") + var ErrInvalidAddress = errors.New("ipc: invalid agent address") + var ErrInvalidMessage = errors.New("ipc: invalid agent message") + var ErrInvalidReply = errors.New("ipc: invalid reply or missing correlation id") + var ErrMessageExpired = errors.New("ipc: message deadline expired") + var ErrMessageNotFound = errors.New("ipc: message not found") + var ErrPeerDenied = errors.New("ipc: peer communication denied by policy") + var ErrReceiverDenied = errors.New("ipc: receiver policy denied communication from sender") + var ErrTimeout = errors.New("ipc: request timed out waiting for reply") + var ErrUnauthorizedSignal = errors.New("ipc: unauthorized signal dispatch denied") + type AgentAddress struct + AgentID string + InstanceID string + Namespace string + TenantID string + func NewAddress(tenantID, namespace, agentID string) AgentAddress + func NewInstanceAddress(tenantID, namespace, agentID, instanceID string) AgentAddress + func ParseAddress(raw string) (AgentAddress, error) + func (a *AgentAddress) UnmarshalJSON(data []byte) error + func (a *AgentAddress) UnmarshalText(text []byte) error + func (a AgentAddress) EffectiveNamespace() string + func (a AgentAddress) IsInstance() bool + func (a AgentAddress) Logical() AgentAddress + func (a AgentAddress) MarshalJSON() ([]byte, error) + func (a AgentAddress) MarshalText() ([]byte, error) + func (a AgentAddress) Matches(target AgentAddress) bool + func (a AgentAddress) String() string + func (a AgentAddress) Validate() error + type AgentMessage struct + AckedAt *time.Time + CorrelationID string + CreatedAt time.Time + Deadline time.Time + ID string + Namespace string + Payload []byte + Receiver AgentAddress + Sender AgentAddress + SignalType SignalType + Status DeliveryStatus + TenantID string + TraceID string + Type MessageType + func NewMessage(sender, receiver AgentAddress, msgType MessageType, payload []byte, ...) (*AgentMessage, error) + func NewReply(sender, receiver AgentAddress, correlationID string, payload []byte, ...) (*AgentMessage, error) + func NewRequest(sender, receiver AgentAddress, correlationID string, payload []byte, ...) (*AgentMessage, error) + func NewSignal(sender, receiver AgentAddress, sigType SignalType, reason string, ...) (*AgentMessage, error) + func (m *AgentMessage) Clone() *AgentMessage + func (m *AgentMessage) IsExpired(now time.Time) bool + func (m *AgentMessage) ParseSignalPayload() (*SignalPayload, error) + func (m *AgentMessage) Validate() error + type AuditRecord struct + Action string + MessageID string + MessageType MessageType + Namespace string + Reason string + ReasonCode string + Receiver string + Result string + Sender string + TenantID string + Timestamp time.Time + TraceID string + type Auditor interface + LogAudit func(ctx context.Context, record AuditRecord) + type AuthorizationDecision struct + Allowed bool + EvaluatedAt time.Time + Reason string + ReasonCode string + Receiver string + Sender string + TenantID string + TraceID string + type CapabilityChecker interface + CheckCapability func(ctx context.Context, tenantID string, addr AgentAddress, capability string) error + type DefaultPolicy struct + func NewDefaultPolicy(checker CapabilityChecker, fencer Fencer, opts ...PolicyOption) *DefaultPolicy + func (p *DefaultPolicy) AllowCrossNamespace(tenantID, fromNS, toNS string) + func (p *DefaultPolicy) AllowPeer(sender AgentAddress, rule PeerRule) + func (p *DefaultPolicy) AllowReceiver(receiver AgentAddress, rule PeerRule) + func (p *DefaultPolicy) AuthorizeReceive(ctx context.Context, receiver AgentAddress) error + func (p *DefaultPolicy) AuthorizeSend(ctx context.Context, msg *AgentMessage) error + func (p *DefaultPolicy) AuthorizeSendWithDecision(ctx context.Context, msg *AgentMessage) (*AuthorizationDecision, error) + func (p *DefaultPolicy) DisallowCrossNamespace(tenantID, fromNS, toNS string) + func (p *DefaultPolicy) PeerAuthorizer() PeerAuthorizer + func (p *DefaultPolicy) SetPeerAuthorizer(authorizer PeerAuthorizer) + type DeliveryStatus string + const StatusAcked + const StatusDelivered + const StatusExpired + const StatusPending + type DurableMemoryMailbox struct + func NewDurableMemoryMailbox() *DurableMemoryMailbox + func NewDurableMemoryMailboxWithClock(clock func() time.Time) *DurableMemoryMailbox + func (m *DurableMemoryMailbox) Ack(ctx context.Context, receiver AgentAddress, messageIDs []string) error + func (m *DurableMemoryMailbox) GetByCorrelationID(ctx context.Context, tenantID, correlationID string) (*AgentMessage, error) + func (m *DurableMemoryMailbox) GetMessage(ctx context.Context, id string) (*AgentMessage, error) + func (m *DurableMemoryMailbox) Receive(ctx context.Context, receiver AgentAddress, limit int) ([]*AgentMessage, error) + func (m *DurableMemoryMailbox) Restore(data []byte) error + func (m *DurableMemoryMailbox) Send(ctx context.Context, msg *AgentMessage) error + func (m *DurableMemoryMailbox) SimulateCrash() (*DurableMemoryMailbox, error) + func (m *DurableMemoryMailbox) Snapshot() ([]byte, error) + type Fencer interface + ValidateInstance func(ctx context.Context, addr AgentAddress) error + type Mailbox interface + Ack func(ctx context.Context, receiver AgentAddress, messageIDs []string) error + GetByCorrelationID func(ctx context.Context, tenantID, correlationID string) (*AgentMessage, error) + GetMessage func(ctx context.Context, id string) (*AgentMessage, error) + Receive func(ctx context.Context, receiver AgentAddress, limit int) ([]*AgentMessage, error) + Send func(ctx context.Context, msg *AgentMessage) error + type MemoryAuditor struct + func NewMemoryAuditor() *MemoryAuditor + func (a *MemoryAuditor) Count() int + func (a *MemoryAuditor) LogAudit(ctx context.Context, record AuditRecord) + func (a *MemoryAuditor) Records() []AuditRecord + type MemoryCapabilityChecker struct + func NewMemoryCapabilityChecker() *MemoryCapabilityChecker + func (c *MemoryCapabilityChecker) CheckCapability(ctx context.Context, tenantID string, addr AgentAddress, capability string) error + func (c *MemoryCapabilityChecker) Grant(addr AgentAddress, capability string) + func (c *MemoryCapabilityChecker) Revoke(addr AgentAddress, capability string) + type MemoryFencer struct + func NewMemoryFencer() *MemoryFencer + func (f *MemoryFencer) FenceInstance(addr AgentAddress) + func (f *MemoryFencer) UnfenceInstance(addr AgentAddress) + func (f *MemoryFencer) ValidateInstance(ctx context.Context, addr AgentAddress) error + type MemoryPeerAuthorizer struct + func NewMemoryPeerAuthorizer(defaultDeny bool) *MemoryPeerAuthorizer + func (a *MemoryPeerAuthorizer) AllowPeer(sender AgentAddress, rule PeerRule) + func (a *MemoryPeerAuthorizer) AllowReceiver(receiver AgentAddress, rule PeerRule) + func (a *MemoryPeerAuthorizer) AuthorizePeer(ctx context.Context, sender, receiver AgentAddress) (*AuthorizationDecision, error) + func (a *MemoryPeerAuthorizer) SetAllowedPeers(sender AgentAddress, rules []PeerRule) + func (a *MemoryPeerAuthorizer) SetReceiverPolicy(receiver AgentAddress, rules []PeerRule) + type MessageType string + const MessageTypeReply + const MessageTypeRequest + const MessageTypeSignal + type Metrics interface + RecordAcked func(ctx context.Context, tenantID string, count int) + RecordDeliveryDuration func(ctx context.Context, tenantID string, duration time.Duration) + RecordDenied func(ctx context.Context, tenantID string, reason string) + RecordExpired func(ctx context.Context, tenantID string) + RecordReceived func(ctx context.Context, tenantID string, msgType MessageType) + RecordSent func(ctx context.Context, tenantID string, msgType MessageType) + type PeerAuthorizer interface + AuthorizePeer func(ctx context.Context, sender, receiver AgentAddress) (*AuthorizationDecision, error) + type PeerRule struct + Agent string + Namespace string + func (r PeerRule) Matches(senderNS string, target AgentAddress) bool + type Policy interface + AuthorizeReceive func(ctx context.Context, receiver AgentAddress) error + AuthorizeSend func(ctx context.Context, msg *AgentMessage) error + type PolicyOption func(*DefaultPolicy) + func WithPeerAuthorizer(authorizer PeerAuthorizer) PolicyOption + type PostgresMailbox struct + func NewPostgresMailbox(pool *pgxpool.Pool) *PostgresMailbox + func NewPostgresMailboxWithClock(pool *pgxpool.Pool, clock func() time.Time) *PostgresMailbox + func (p *PostgresMailbox) Ack(ctx context.Context, receiver AgentAddress, messageIDs []string) error + func (p *PostgresMailbox) GetByCorrelationID(ctx context.Context, tenantID, correlationID string) (*AgentMessage, error) + func (p *PostgresMailbox) GetMessage(ctx context.Context, id string) (*AgentMessage, error) + func (p *PostgresMailbox) Receive(ctx context.Context, receiver AgentAddress, limit int) ([]*AgentMessage, error) + func (p *PostgresMailbox) Send(ctx context.Context, msg *AgentMessage) error + type Service struct + func NewService(cfg ServiceConfig) *Service + func (s *Service) Ack(ctx context.Context, receiver AgentAddress, messageIDs []string) error + func (s *Service) Receive(ctx context.Context, receiver AgentAddress, limit int) ([]*AgentMessage, error) + func (s *Service) Send(ctx context.Context, msg *AgentMessage) error + func (s *Service) SendReply(ctx context.Context, reply *AgentMessage) error + func (s *Service) SendRequest(ctx context.Context, req *AgentMessage, timeout time.Duration) (*AgentMessage, error) + func (s *Service) SendSignal(ctx context.Context, sender, receiver AgentAddress, sigType SignalType, ...) (*AgentMessage, error) + type ServiceConfig struct + Auditor Auditor + Mailbox Mailbox + Metrics Metrics + Policy Policy + Tracer trace.Tracer + type SignalPayload struct + Metadata map[string]string + Reason string + SignalType SignalType + type SignalType string + const SignalCustom + const SignalPause + const SignalResume + const SignalStop + const SignalWake + type StandardMetrics struct + func NewStandardMetrics() *StandardMetrics + func (m *StandardMetrics) AckedCount() int64 + func (m *StandardMetrics) DeniedCount() int64 + func (m *StandardMetrics) ExpiredCount() int64 + func (m *StandardMetrics) ReceivedCount(msgType MessageType) int64 + func (m *StandardMetrics) RecordAcked(ctx context.Context, tenantID string, count int) + func (m *StandardMetrics) RecordDeliveryDuration(ctx context.Context, tenantID string, duration time.Duration) + func (m *StandardMetrics) RecordDenied(ctx context.Context, tenantID string, reason string) + func (m *StandardMetrics) RecordExpired(ctx context.Context, tenantID string) + func (m *StandardMetrics) RecordReceived(ctx context.Context, tenantID string, msgType MessageType) + func (m *StandardMetrics) RecordSent(ctx context.Context, tenantID string, msgType MessageType) + func (m *StandardMetrics) SentCount(msgType MessageType) int64