hub

package
v0.1.29 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHello       = errors.New("invalid hello")
	ErrVersionUnsupported = errors.New("protocol version unsupported")
)
View Source
var ErrWarmAttachCredentialNotAccepted = errors.New("warm attach credential was not accepted")

Functions

func NewObservabilityHandler added in v0.1.7

func NewObservabilityHandler(token string, next http.Handler) http.Handler

NewObservabilityHandler adds the host-side diagnostic surface without exposing metrics or profiles to a client-facing WebSocket listener.

Types

type AcceptedPeer

type AcceptedPeer struct {
	Role            protocol.Role
	ProtocolVersion int
	Principal       auth.Principal
	SessionID       string
	Provider        string
	Resume          bool
	Subscribed      []protocol.Subscription
	Admissions      map[string]auth.SessionAdmissionDecision
	AdmissionClaims map[string]auth.SessionAdmissionClaim
	AttentionOnly   bool
}

type ActivityDispatcher added in v0.1.7

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

ActivityDispatcher performs bounded keyset rescans. It has one ticker for the whole Store and creates no Session-specific timers or goroutines.

func NewActivityDispatcher added in v0.1.7

func (*ActivityDispatcher) DispatchOnce added in v0.1.7

func (d *ActivityDispatcher) DispatchOnce(ctx context.Context) error

func (*ActivityDispatcher) RequestActivityRefresh added in v0.1.7

func (d *ActivityDispatcher) RequestActivityRefresh(ctx context.Context) error

RequestActivityRefresh requests one immediate Store-derived summary rescan. Concurrent calls wait for the same scan, so the request cannot multiply Store reads, callbacks, or background work.

func (*ActivityDispatcher) Run added in v0.1.7

type ActivityDispatcherConfig added in v0.1.7

type ActivityDispatcherConfig struct {
	Interval time.Duration
}

type ActivitySink added in v0.1.7

type ActivitySink interface {
	PublishActivitySummary(context.Context, ActivitySummary) error
}

type ActivitySinkFunc added in v0.1.7

type ActivitySinkFunc func(context.Context, ActivitySummary) error

func (ActivitySinkFunc) PublishActivitySummary added in v0.1.7

func (fn ActivitySinkFunc) PublishActivitySummary(ctx context.Context, summary ActivitySummary) error

type ActivitySummary added in v0.1.7

type ActivitySummary struct {
	SessionID           string
	State               string
	LastDurableSeq      int64
	LedgerVersion       int64
	LastDurableEventAt  *time.Time
	LastClientCommandAt *time.Time
	StoreSnapshotAt     time.Time
	ProjectionState     string
	BlockerKind         string
	BlockerExpiresAt    *time.Time
}

ActivitySink receives provider-neutral, Store-committed activity summaries. It deliberately contains only durable summary facts, so dispatch cannot become another source of activity truth.

type AdapterActivity

type AdapterActivity struct {
	SessionID string
	At        time.Time
}

type AdapterActivityObserver

type AdapterActivityObserver interface {
	ObserveAdapterActivity(context.Context, AdapterActivity)
}

type CommandActivity

type CommandActivity struct {
	SessionID  string
	CommandID  string
	Type       protocol.CommandType
	At         time.Time
	DurableSeq *int64
}

type CommandActivityObserver

type CommandActivityObserver interface {
	ObserveCommandActivity(context.Context, CommandActivity)
}

type EphemeralBroadcaster

type EphemeralBroadcaster interface {
	http.Handler
	EmitEphemeralEvent(context.Context, protocol.Event) error
	RunActivityDispatcher(context.Context) error
	RequestActivityRefresh(context.Context) error
}

func NewWebSocketHandler

func NewWebSocketHandler(cfg WebSocketConfig) EphemeralBroadcaster

type Handshake

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

func NewHandshake

func NewHandshake(cfg HandshakeConfig) *Handshake

func (*Handshake) AuthorizeAttach added in v0.1.7

func (h *Handshake) AuthorizeAttach(ctx context.Context, peer AcceptedPeer, rawGrant string) (auth.AttachAuthorization, error)

AuthorizeAttach consumes the raw grant exactly at Client-to-Hub ingress. It returns verified bounded claims only; T18B must repeat bootstrap checks in its Store transaction before creating any durable attach state.

func (*Handshake) AuthorizeAttention added in v0.1.7

func (h *Handshake) AuthorizeAttention(ctx context.Context, principal auth.Principal) (auth.AttentionGrant, error)

AuthorizeAttention rechecks the Auth-owned grant for a live attention connection. Callers must not cache it across a Store read or websocket send.

func (*Handshake) HandleHello

func (h *Handshake) HandleHello(ctx context.Context, hello *protocol.Hello) (protocol.HelloAck, AcceptedPeer, error)

func (*Handshake) SetLiveBootstrapAuthorityResolver added in v0.1.7

func (h *Handshake) SetLiveBootstrapAuthorityResolver(resolver LiveBootstrapAuthorityResolver)

type HandshakeConfig

type HandshakeConfig struct {
	Authenticator          auth.Authenticator
	AttachGrantVerifier    auth.AttachGrantVerifier
	AttachGrantAudience    string
	LiveBootstrapAuthority LiveBootstrapAuthorityResolver
	EventStore             interface {
		LatestSeq(ctx context.Context, sessionID string) (int64, error)
	}
}

type LiveBootstrapAuthorityResolver added in v0.1.7

type LiveBootstrapAuthorityResolver interface {
	CurrentBootstrapAuthority(context.Context, auth.AttachGrant) (auth.BootstrapAuthority, error)
}

type SessionAdmissionAuthenticator added in v0.1.7

type SessionAdmissionAuthenticator interface {
	auth.Authenticator
	SessionAdmissionClaim(context.Context, auth.Principal, string) (auth.SessionAdmissionClaim, error)
}

type WarmAttachCredentialDelivery added in v0.1.7

type WarmAttachCredentialDelivery struct {
	AttachID                   string
	TargetSessionID            string
	TargetCredentialLineageRef string
	Generation                 int64
	ExpiresAt                  time.Time
}

WarmAttachCredentialDelivery is committed, non-secret target identity. It is deliberately independent from the pending-join wire transport owned by T18G.

type WarmAttachCredentialHandoff added in v0.1.7

type WarmAttachCredentialHandoff interface {
	DeliverCommittedTargetCredential(context.Context, WarmAttachCredentialDelivery, auth.PreparedSessionCredential) error
}

WarmAttachCredentialHandoff receives one already-committed target bearer. Its bounded internal transfer runs while Store owns both final tuples; T18G alone owns any later pending-join protocol/socket transport and rechecks it at that delivery boundary.

type WebSocketConfig

type WebSocketConfig struct {
	Handshake                         *Handshake
	EventStore                        store.EventStore
	ActivitySummaryStore              store.AttentionSummaryPageStore
	ActivitySink                      ActivitySink
	HandshakeTimeout                  time.Duration
	CommandActivityObserver           CommandActivityObserver
	AdapterActivityObserver           AdapterActivityObserver
	SessionCredentialIssuer           auth.SessionCredentialIssuer
	SessionCredentialLifecycle        auth.SessionCredentialLifecycle
	SessionCredentialEvidenceResolver auth.SessionCredentialEvidenceResolver
	EphemeralEventVariants            map[string]map[int]string
	// Deprecated: credential delivery is always the Hub-owned pending target
	// socket. Retained only to avoid a source-incompatible config removal.
	WarmAttachCredentialHandoff WarmAttachCredentialHandoff
}

Jump to

Keyboard shortcuts

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