Documentation
¶
Index ¶
- Variables
- func AgentEventIdentityMatches(defaultNetworkID, candidate string, event protocol.Event) bool
- func AgentIdentityMatches(credentialNetwork, credentialID, parentNetwork, parentID string) bool
- type Error
- type EventBroker
- type PairingClient
- type Service
- func (s *Service) AcknowledgeAttachmentContext(ctx context.Context, agentID string, eventID string) error
- func (s *Service) AgentConnected(ctx context.Context, agent protocol.Actor)
- func (s *Service) AgentDisconnected(ctx context.Context, agent protocol.Actor, reason string, err error)
- func (s *Service) AgentWakeDelivered(ctx context.Context, agent protocol.Actor, event protocol.Event)
- func (s *Service) AgentWakeFailed(ctx context.Context, agent protocol.Actor, event protocol.Event, err error, ...)
- func (s *Service) ApplyConfigContext(ctx context.Context, request protocol.ApplyConfigRequest) (protocol.ApplyConfigResult, error)
- func (s *Service) AuthenticateAgentTokenContext(ctx context.Context, token string) (authn.Claims, bool, error)
- func (s *Service) Close() error
- func (s *Service) CreateRoom(request protocol.CreateRoomRequest) (protocol.Room, error)
- func (s *Service) CreateRoomContext(ctx context.Context, request protocol.CreateRoomRequest) (protocol.Room, error)
- func (s *Service) EnsureFollowRoom(ctx context.Context, config protocol.Follow, remote protocol.Room) error
- func (s *Service) GetAgent(agentID string) (protocol.AgentSummary, error)
- func (s *Service) GetAgentContext(ctx context.Context, agentID string) (protocol.AgentSummary, error)
- func (s *Service) GetDirectConversation(dmID string) (protocol.DirectConversation, error)
- func (s *Service) GetDirectConversationContext(ctx context.Context, dmID string) (protocol.DirectConversation, error)
- func (s *Service) GetFollowCheckpoint(ctx context.Context, key string) (follow.Checkpoint, error)
- func (s *Service) GetRoom(roomID string) (protocol.Room, error)
- func (s *Service) GetRoomContext(ctx context.Context, roomID string) (protocol.Room, error)
- func (s *Service) GetThread(threadID string) (protocol.Thread, error)
- func (s *Service) GetThreadContext(ctx context.Context, threadID string) (protocol.Thread, error)
- func (s *Service) Health(ctx context.Context) error
- func (s *Service) ImportFollowMessage(ctx context.Context, config protocol.Follow, networkID string, ...) (bool, error)
- func (s *Service) JoinRoomContext(ctx context.Context, roomID string, request protocol.JoinRoomRequest) (protocol.Room, error)
- func (s *Service) ListAgents() ([]protocol.AgentSummary, error)
- func (s *Service) ListAgentsContext(ctx context.Context, page protocol.PageRequest) (protocol.AgentPage, error)
- func (s *Service) ListArtifacts(filter protocol.ArtifactFilter, before string, limit int) (protocol.ArtifactPage, error)
- func (s *Service) ListArtifactsContext(ctx context.Context, filter protocol.ArtifactFilter, page protocol.PageRequest) (protocol.ArtifactPage, error)
- func (s *Service) ListDMMessages(dmID string, before string, limit int) (protocol.MessagePage, error)
- func (s *Service) ListDMMessagesContext(ctx context.Context, dmID string, page protocol.PageRequest) (protocol.MessagePage, error)
- func (s *Service) ListDirectConversations() (protocol.DirectConversationPage, error)
- func (s *Service) ListDirectConversationsContext(ctx context.Context, page protocol.PageRequest) (protocol.DirectConversationPage, error)
- func (s *Service) ListFollowsContext(context.Context) (protocol.FollowPage, error)
- func (s *Service) ListPairings() ([]protocol.Pairing, error)
- func (s *Service) ListPairingsContext(ctx context.Context, page protocol.PageRequest) (protocol.PairingPage, error)
- func (s *Service) ListRoomMessages(roomID string, before string, limit int) (protocol.MessagePage, error)
- func (s *Service) ListRoomMessagesContext(ctx context.Context, roomID string, page protocol.PageRequest) (protocol.MessagePage, error)
- func (s *Service) ListRooms() ([]protocol.Room, error)
- func (s *Service) ListRoomsContext(ctx context.Context, page protocol.PageRequest) (protocol.RoomPage, error)
- func (s *Service) ListThreadMessages(threadID string, before string, limit int) (protocol.MessagePage, error)
- func (s *Service) ListThreadMessagesContext(ctx context.Context, threadID string, page protocol.PageRequest) (protocol.MessagePage, error)
- func (s *Service) ListThreads(roomID string) (protocol.ThreadPage, error)
- func (s *Service) ListThreadsContext(ctx context.Context, roomID string, page protocol.PageRequest) (protocol.ThreadPage, error)
- func (s *Service) Network() protocol.Network
- func (s *Service) PairingAgents(ctx context.Context, pairingID string) ([]protocol.AgentSummary, error)
- func (s *Service) PairingAgentsContext(ctx context.Context, pairingID string, page protocol.PageRequest) (protocol.AgentPage, error)
- func (s *Service) PairingForPairScopedContext(ctx context.Context) (protocol.Pairing, bool)
- func (s *Service) PairingNetwork(ctx context.Context, pairingID string) (protocol.Network, error)
- func (s *Service) PairingRooms(ctx context.Context, pairingID string) ([]protocol.Room, error)
- func (s *Service) PairingRoomsContext(ctx context.Context, pairingID string, page protocol.PageRequest) (protocol.RoomPage, error)
- func (s *Service) ReconcileRoomContext(ctx context.Context, request protocol.CreateRoomRequest) (protocol.Room, error)
- func (s *Service) RegisterAgentContext(ctx context.Context, request protocol.RegisterAgentRequest) (store.RegistrationResult, error)
- func (s *Service) RegisterDurableAttachmentContext(ctx context.Context, request protocol.RegisterAgentRequest) (protocol.AgentRegistration, <-chan protocol.Event, bool, error)
- func (s *Service) RemoveAgentContext(ctx context.Context, agentID string) (protocol.RemoveResult, error)
- func (s *Service) RemoveRoomContext(ctx context.Context, roomID string) (protocol.RemoveResult, error)
- func (s *Service) SendMessage(request protocol.SendMessageRequest) (protocol.MessageAccepted, error)
- func (s *Service) SendMessageContext(ctx context.Context, request protocol.SendMessageRequest) (protocol.MessageAccepted, error)
- func (s *Service) SetFollowCheckpoint(ctx context.Context, key string, value follow.Checkpoint) error
- func (s *Service) SetFollowCheckpoints(ctx context.Context, values map[string]follow.Checkpoint, ...) error
- func (s *Service) StartPairingDelivery()
- func (s *Service) Subscribe(ctx context.Context) <-chan protocol.Event
- func (s *Service) SubscribeFrom(ctx context.Context, lastEventID string) <-chan protocol.Event
- func (s *Service) SubscribeFromContext(ctx context.Context, lastEventID string) (<-chan protocol.Event, error)
- func (s *Service) UpdateRoomMembers(ctx context.Context, roomID string, request protocol.UpdateRoomMembersRequest) (protocol.Room, error)
- type ServiceConfig
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidRoomID = errors.New("room id is required") ErrInvalidRoomRequest = errors.New("invalid room request") ErrRoomExists = errors.New("room already exists") ErrUnknownRoom = errors.New("unknown room") ErrUnknownThread = errors.New("unknown thread") ErrUnknownAgent = errors.New("unknown agent") ErrInvalidDMID = errors.New("dm id is required") ErrInvalidCursor = errors.New("invalid cursor") ErrInvalidMessage = errors.New("invalid message request") ErrDMTopologyConflict = errors.New("direct message participant topology is invalid") ErrUnknownDM = errors.New("unknown direct conversation") ErrArtifactFilter = errors.New("artifact filter is required") ErrUnknownPairing = errors.New("unknown pairing") ErrPairingClientMissing = errors.New("pairing client is not configured") ErrHumanIngressDisabled = errors.New("human ingress is disabled") ErrDirectMessagesDisabled = errors.New("direct messages are disabled") ErrRemotePairing = errors.New("paired network request failed") ErrAgentConflict = errors.New("agent identity conflict") ErrAgentForbidden = errors.New("agent identity is forbidden") ErrWriteForbidden = errors.New("room write policy forbids sender") )
Functions ¶
func AgentEventIdentityMatches ¶ added in v0.1.14
AgentEventIdentityMatches resolves every identity authority on an agent event before comparing it with an attachment or restricted claim. Empty authorities inherit defaultNetworkID; explicit authorities must agree.
func AgentIdentityMatches ¶ added in v0.1.14
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func (*Error) StatusCode ¶
type EventBroker ¶
type PairingClient ¶
type PairingClient interface {
FetchNetwork(ctx context.Context, pairing protocol.Pairing) (protocol.Network, error)
FetchRooms(ctx context.Context, pairing protocol.Pairing) ([]protocol.Room, error)
FetchAgents(ctx context.Context, pairing protocol.Pairing) ([]protocol.AgentSummary, error)
RelayMessage(ctx context.Context, pairing protocol.Pairing, request protocol.SendMessageRequest) (protocol.MessageAccepted, error)
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(config ServiceConfig) *Service
func (*Service) AcknowledgeAttachmentContext ¶ added in v0.1.18
func (*Service) AgentConnected ¶ added in v0.1.7
func (*Service) AgentDisconnected ¶ added in v0.1.7
func (*Service) AgentWakeDelivered ¶ added in v0.1.7
func (*Service) AgentWakeFailed ¶ added in v0.1.7
func (*Service) ApplyConfigContext ¶ added in v0.1.12
func (s *Service) ApplyConfigContext( ctx context.Context, request protocol.ApplyConfigRequest, ) (protocol.ApplyConfigResult, error)
func (*Service) AuthenticateAgentTokenContext ¶ added in v0.1.1
func (*Service) CreateRoom ¶
func (*Service) CreateRoomContext ¶
func (*Service) EnsureFollowRoom ¶ added in v0.1.20
func (*Service) GetAgent ¶
func (s *Service) GetAgent(agentID string) (protocol.AgentSummary, error)
func (*Service) GetAgentContext ¶ added in v0.1.11
func (*Service) GetDirectConversation ¶
func (s *Service) GetDirectConversation(dmID string) (protocol.DirectConversation, error)
func (*Service) GetDirectConversationContext ¶ added in v0.1.14
func (*Service) GetFollowCheckpoint ¶ added in v0.1.20
func (*Service) GetRoomContext ¶ added in v0.1.11
func (*Service) GetThreadContext ¶ added in v0.1.11
func (*Service) ImportFollowMessage ¶ added in v0.1.20
func (*Service) JoinRoomContext ¶ added in v0.1.14
func (*Service) ListAgents ¶
func (s *Service) ListAgents() ([]protocol.AgentSummary, error)
func (*Service) ListAgentsContext ¶
func (s *Service) ListAgentsContext(ctx context.Context, page protocol.PageRequest) (protocol.AgentPage, error)
ListAgentsContext derives the whole roster from rooms this caller may see: readableRoom drops rooms they cannot read, roomVisibleToPairScopedContext drops rooms their pairing is not federated with, and an agent is named here only by surviving-room membership or by canReadPrivateRoster (which a pure [pair] peer credential fails). That is the entire pair-scoped agent filter.
A second, redundant filter used to sit in front of this, behind an `agentRegistry == nil && contextAgents != nil` fast path. Both fields are type assertions on the same config.Store and every store here (MemoryStore, FileStore, SQLStore) satisfies both interfaces, so the branch was unreachable -- `panic("REACHED")` in it left the suite green. Deleted rather than kept-and-unreached; TestPairScopedAgentListingIsFilteredByFederation (federation_access_test.go) now pins the guarantee on the one live path.
func (*Service) ListArtifacts ¶
func (s *Service) ListArtifacts( filter protocol.ArtifactFilter, before string, limit int, ) (protocol.ArtifactPage, error)
func (*Service) ListArtifactsContext ¶
func (s *Service) ListArtifactsContext( ctx context.Context, filter protocol.ArtifactFilter, page protocol.PageRequest, ) (protocol.ArtifactPage, error)
func (*Service) ListDMMessages ¶
func (*Service) ListDMMessagesContext ¶
func (s *Service) ListDMMessagesContext( ctx context.Context, dmID string, page protocol.PageRequest, ) (protocol.MessagePage, error)
func (*Service) ListDirectConversations ¶
func (s *Service) ListDirectConversations() (protocol.DirectConversationPage, error)
func (*Service) ListDirectConversationsContext ¶
func (s *Service) ListDirectConversationsContext(ctx context.Context, page protocol.PageRequest) (protocol.DirectConversationPage, error)
func (*Service) ListFollowsContext ¶ added in v0.1.20
func (*Service) ListPairingsContext ¶
func (s *Service) ListPairingsContext(ctx context.Context, page protocol.PageRequest) (protocol.PairingPage, error)
func (*Service) ListRoomMessages ¶
func (*Service) ListRoomMessagesContext ¶
func (s *Service) ListRoomMessagesContext( ctx context.Context, roomID string, page protocol.PageRequest, ) (protocol.MessagePage, error)
func (*Service) ListRoomsContext ¶
func (*Service) ListThreadMessages ¶
func (*Service) ListThreadMessagesContext ¶
func (s *Service) ListThreadMessagesContext( ctx context.Context, threadID string, page protocol.PageRequest, ) (protocol.MessagePage, error)
func (*Service) ListThreads ¶
func (s *Service) ListThreads(roomID string) (protocol.ThreadPage, error)
func (*Service) ListThreadsContext ¶
func (s *Service) ListThreadsContext(ctx context.Context, roomID string, page protocol.PageRequest) (protocol.ThreadPage, error)
func (*Service) PairingAgents ¶
func (*Service) PairingAgentsContext ¶
func (*Service) PairingForPairScopedContext ¶ added in v0.1.15
PairingForPairScopedContext is pairingForPairScopedContext, exported so internal/transport's federation discovery gate (filterPairScopedRoomDiscovery, federation_discovery.go) can share the exact same resolution strategy instead of re-deriving its own.
P1-1 (final-gate review, confirmed live): before this export existed, that transport-layer gate matched a pair-scoped caller's pairing by claims.Network() alone -- the network-fallback half of this method's own strategy, with no token-id-first lookup at all. `pair invite` never persists a network binding on the inviter side (that is why the 7B.2 default flip was reverted, see PLAN.md 7B.2), so every inviter-issued pairing credential resolved to nothing and GET /v1/rooms came back empty for it, even though this same service's own room-visibility gate (roomVisibleToPairScopedContext, right below) would have allowed its federated rooms via the token-id lookup above. The two gates enforced different pairing identities for the same request. Exporting this one resolution method -- rather than exporting a second predicate transport re-implements independently, the mistake that produced the divergence in the first place -- means there is exactly one strategy for "which pairing does this pair-scoped credential belong to," and every gate that needs it calls this.
func (*Service) PairingNetwork ¶
func (*Service) PairingRooms ¶
func (*Service) PairingRoomsContext ¶
func (*Service) ReconcileRoomContext ¶ added in v0.1.11
func (*Service) RegisterAgentContext ¶
func (s *Service) RegisterAgentContext( ctx context.Context, request protocol.RegisterAgentRequest, ) (store.RegistrationResult, error)
func (*Service) RegisterDurableAttachmentContext ¶ added in v0.1.18
func (s *Service) RegisterDurableAttachmentContext( ctx context.Context, request protocol.RegisterAgentRequest, ) (protocol.AgentRegistration, <-chan protocol.Event, bool, error)
RegisterDurableAttachmentContext closes the registration/subscription gap: the agent is authenticated and registered before its durable baseline is created, while message commit and publication are excluded by deliveryMu.
func (*Service) RemoveAgentContext ¶ added in v0.1.10
func (*Service) RemoveRoomContext ¶ added in v0.1.10
func (*Service) SendMessage ¶
func (s *Service) SendMessage(request protocol.SendMessageRequest) (protocol.MessageAccepted, error)
func (*Service) SendMessageContext ¶
func (s *Service) SendMessageContext(ctx context.Context, request protocol.SendMessageRequest) (protocol.MessageAccepted, error)
func (*Service) SetFollowCheckpoint ¶ added in v0.1.20
func (*Service) SetFollowCheckpoints ¶ added in v0.1.20
func (*Service) StartPairingDelivery ¶ added in v0.1.21
func (s *Service) StartPairingDelivery()
StartPairingDelivery resumes the durable outbox after initial configuration has been applied. New messages also start the worker after acceptance.
func (*Service) SubscribeFrom ¶
func (*Service) SubscribeFromContext ¶ added in v0.1.19
type ServiceConfig ¶
type ServiceConfig struct {
// Now stamps domain data only; operational deadlines always use real time.
Now func() (time.Time, error)
AllowHumanIngress bool
DebugEvents bool
DisableDirectMessages bool
RequirePairNetworkBinding bool
NetworkID string
NetworkName string
Pairings []protocol.Pairing
Version string
Store store.RoomStore
Messages store.MessageStore
Broker EventBroker
PairingClient PairingClient
DeliveryRetryMin time.Duration
DeliveryRetryMax time.Duration
DeliveryPollInterval time.Duration
DeliveryTimeout time.Duration
// CausalWriter is optional. When set, SendMessageContext stamps a
// message.accepted causal event (pkg/protocol.CausalEvent) after each
// durable, non-duplicate message append. When nil, causal stamping is
// skipped entirely and message send behavior is unchanged.
CausalWriter *observability.CausalWriter
// TranscriptWriter is optional. When set, accepted room/DM messages are
// exported beside causal.jsonl as research data for the memetics programme.
TranscriptWriter *observability.TranscriptWriter
}
Source Files
¶
- access_policy.go
- agents.go
- apply.go
- causal.go
- collections.go
- credential_policy.go
- delivery.go
- delivery_send.go
- errors.go
- events.go
- federation_access.go
- follow_checkpoints.go
- follows.go
- ids.go
- join.go
- mentions.go
- messaging.go
- pairing_binding.go
- pairing_diagnostics.go
- pairing_visibility.go
- pairings.go
- private_visibility.go
- query.go
- reconcile.go
- relay.go
- removal.go
- sender_identity.go
- service.go
- service_collections.go
- subscription.go
- validate.go