listener

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: Apache-2.0 Imports: 37 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyHostNotificationHandles

func ApplyHostNotificationHandles(event *HostNotificationEvent, senderHandle string, recipientHandle string)

func HasDisconnectedSessions

func HasDisconnectedSessions(sessions []SessionStatus) bool

func RunForeground

func RunForeground(resolved *appconfig.Resolved) error

func RunService

func RunService(resolved *appconfig.Resolved) error

func SessionWarnings

func SessionWarnings(sessions []SessionStatus) []string

Types

type DirectMessageNotificationData

type DirectMessageNotificationData struct {
	Channel         string `json:"channel"`
	SourceKind      string `json:"source_kind,omitempty"`
	MessageID       string `json:"message_id"`
	OperationID     string `json:"operation_id,omitempty"`
	ConversationID  string `json:"conversation_id,omitempty"`
	SenderHandle    string `json:"sender_handle,omitempty"`
	SenderDID       string `json:"sender_did"`
	RecipientHandle string `json:"recipient_handle,omitempty"`
	RecipientDID    string `json:"recipient_did"`
	Profile         string `json:"profile,omitempty"`
	SecurityProfile string `json:"security_profile,omitempty"`
	ContentType     string `json:"content_type"`
	Text            string `json:"text,omitempty"`
	CreatedAt       string `json:"created_at,omitempty"`
	MailboxAddress  string `json:"mailbox_address,omitempty"`
	MailboxDID      string `json:"mailbox_did,omitempty"`
	FromAddr        string `json:"from_addr,omitempty"`
	Subject         string `json:"subject,omitempty"`
	Preview         string `json:"preview,omitempty"`
	HasAttachments  bool   `json:"has_attachments,omitempty"`
}

DirectMessageNotificationData is the minimal message-style payload exposed to host integrations for private notifications. It is also used as the phase-1 mail-unification envelope: mail notifications reuse the same event topic and add source_kind=mail plus mail-specific fields.

type GroupMessageNotificationData

type GroupMessageNotificationData struct {
	Channel           string `json:"channel"`
	MessageID         string `json:"message_id"`
	OperationID       string `json:"operation_id,omitempty"`
	GroupDID          string `json:"group_did"`
	SenderHandle      string `json:"sender_handle,omitempty"`
	SenderDID         string `json:"sender_did"`
	RecipientHandle   string `json:"recipient_handle,omitempty"`
	RecipientDID      string `json:"recipient_did"`
	Profile           string `json:"profile,omitempty"`
	SecurityProfile   string `json:"security_profile,omitempty"`
	ContentType       string `json:"content_type"`
	Text              string `json:"text,omitempty"`
	GroupStateVersion string `json:"group_state_version,omitempty"`
	GroupEventSeq     string `json:"group_event_seq,omitempty"`
	AcceptedAt        string `json:"accepted_at,omitempty"`
}

GroupMessageNotificationData is the minimal group-message payload exposed to host integrations.

type GroupStateChangedNotificationData

type GroupStateChangedNotificationData struct {
	Channel           string `json:"channel"`
	EventID           string `json:"event_id"`
	EventType         string `json:"event_type,omitempty"`
	GroupDID          string `json:"group_did"`
	RecipientDID      string `json:"recipient_did"`
	ActorDID          string `json:"actor_did,omitempty"`
	SubjectDID        string `json:"subject_did,omitempty"`
	SubjectMethod     string `json:"subject_method,omitempty"`
	MembershipStatus  string `json:"membership_status,omitempty"`
	GroupStateVersion string `json:"group_state_version,omitempty"`
	GroupEventSeq     string `json:"group_event_seq,omitempty"`
	ChangedAt         string `json:"changed_at,omitempty"`
}

GroupStateChangedNotificationData is the minimal group-state payload exposed to host integrations.

type HostNotificationEvent

type HostNotificationEvent struct {
	Version    string `json:"version"`
	ID         string `json:"id"`
	Topic      string `json:"topic"`
	ReceivedAt string `json:"received_at"`
	Data       any    `json:"data,omitempty"`
}

HostNotificationEvent is the normalized event delivered from awiki-cli to a host-facing notification sink.

func NormalizeHostNotification

func NormalizeHostNotification(notification map[string]any, receivedAt time.Time) (*HostNotificationEvent, bool)

NormalizeHostNotification converts a websocket notification into a compact host-facing event.

type HostNotifySink

type HostNotifySink interface {
	Notify(context.Context, HostNotificationEvent) error
	Close() error
}

HostNotifySink receives normalized host notification events.

type HostNotifyStatus

type HostNotifyStatus struct {
	Enabled   bool   `json:"enabled"`
	Sink      string `json:"sink"`
	FilePath  string `json:"file_path,omitempty"`
	HookURL   string `json:"hook_url,omitempty"`
	AgentID   string `json:"agent_id,omitempty"`
	HookName  string `json:"hook_name,omitempty"`
	NotifyURL string `json:"notify_url,omitempty"`
	LastError string `json:"last_error,omitempty"`
}

type SessionStatus

type SessionStatus struct {
	IdentityName string `json:"identity_name"`
	DID          string `json:"did,omitempty"`
	Connected    bool   `json:"connected"`
	LastError    string `json:"last_error,omitempty"`
}

type Status

type Status struct {
	Mode            string           `json:"mode"`
	Installed       bool             `json:"installed"`
	Running         bool             `json:"running"`
	BootID          string           `json:"boot_id,omitempty"`
	PID             int              `json:"pid,omitempty"`
	PIDFile         string           `json:"pid_file,omitempty"`
	SocketPath      string           `json:"socket_path,omitempty"`
	LogFile         string           `json:"log_file,omitempty"`
	StatusFile      string           `json:"status_file,omitempty"`
	ServiceName     string           `json:"service_name,omitempty"`
	ServicePlatform string           `json:"service_platform,omitempty"`
	BridgeAvailable bool             `json:"bridge_available"`
	StartedAt       string           `json:"started_at,omitempty"`
	Sessions        []SessionStatus  `json:"sessions,omitempty"`
	HostNotify      HostNotifyStatus `json:"host_notify"`
	Warnings        []string         `json:"warnings,omitempty"`
}

func ApplyRuntimePolicy

func ApplyRuntimePolicy(resolved *appconfig.Resolved) (Status, error)

func EnsureInstalled

func EnsureInstalled(resolved *appconfig.Resolved) (Status, error)

func Install

func Install(resolved *appconfig.Resolved) (Status, error)

func Restart

func Restart(resolved *appconfig.Resolved) (Status, error)

func RestartService

func RestartService(resolved *appconfig.Resolved) (Status, error)

func Start

func Start(resolved *appconfig.Resolved) (Status, error)

func StartService

func StartService(resolved *appconfig.Resolved) (Status, error)

func StatusFor

func StatusFor(resolved *appconfig.Resolved) (Status, error)

func Stop

func Stop(resolved *appconfig.Resolved) (Status, error)

func StopService

func StopService(resolved *appconfig.Resolved) (Status, error)

func Uninstall

func Uninstall(resolved *appconfig.Resolved) (Status, error)

type Supervisor

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

func NewSupervisor

func NewSupervisor(resolved *appconfig.Resolved) (*Supervisor, error)

func (*Supervisor) Close

func (s *Supervisor) Close() error

func (*Supervisor) Run

func (s *Supervisor) Run(ctx context.Context) error

type WSClient

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

func NewWSClient

func NewWSClient(resolved *appconfig.Resolved, auth *authsdk.Session) (*WSClient, error)

func (*WSClient) Close

func (c *WSClient) Close() error

func (*WSClient) Connect

func (c *WSClient) Connect(ctx context.Context) error

func (*WSClient) Notifications

func (c *WSClient) Notifications() <-chan map[string]any

func (*WSClient) Ping

func (c *WSClient) Ping(ctx context.Context) error

func (*WSClient) ReaderError

func (c *WSClient) ReaderError() error

func (*WSClient) SendRPC

func (c *WSClient) SendRPC(ctx context.Context, method string, params map[string]any) (map[string]any, error)

Jump to

Keyboard shortcuts

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