Documentation
¶
Index ¶
- Constants
- func DefaultRoot() (string, error)
- func WithInboundMessage(ctx context.Context, message InboundMessage) context.Context
- type DeliveryStatus
- type Handler
- type HeldEvictionHandler
- type HeldReleaseHandler
- type HoldCause
- type Identity
- type InboundMessage
- type InboundPolicy
- type Options
- type Peer
- type PermissionClass
- type SendResult
- type Service
- func (service *Service) Close() error
- func (service *Service) List(ctx context.Context) ([]Peer, error)
- func (service *Service) ResolveHeld(ctx context.Context, messageID string, status DeliveryStatus) error
- func (service *Service) Self() Peer
- func (service *Service) Send(ctx context.Context, to, summary, body string) (SendResult, error)
- func (service *Service) SetHeldEvictionHandler(handler HeldEvictionHandler)
- func (service *Service) SetHeldReleaseHandler(handler HeldReleaseHandler)
- func (service *Service) SetStatusHandler(handler StatusHandler)
- func (service *Service) Start(handler Handler) error
- func (service *Service) UpdateIdentity(identity Identity) error
- type StatusEvent
- type StatusHandler
Constants ¶
const (
ProtocolVersion = 1
)
Variables ¶
This section is empty.
Functions ¶
func DefaultRoot ¶
func WithInboundMessage ¶
func WithInboundMessage(ctx context.Context, message InboundMessage) context.Context
WithInboundMessage carries a peer message's relay chain through the agent turn so a deliberate send_message reply or forward can extend it. Ordinary user turns have no chain and start a fresh one.
Types ¶
type DeliveryStatus ¶
type DeliveryStatus string
const ( DeliveryAccepted DeliveryStatus = "accepted" DeliveryHeld DeliveryStatus = "held" DeliveryRefused DeliveryStatus = "refused" DeliveryDelivered DeliveryStatus = "delivered" DeliveryDenied DeliveryStatus = "denied" DeliveryExpired DeliveryStatus = "expired" )
type Handler ¶
type Handler func(InboundMessage) bool
type HeldEvictionHandler ¶
type HeldEvictionHandler func(string)
type HeldReleaseHandler ¶
type HeldReleaseHandler func(InboundMessage)
type Identity ¶
type Identity struct {
SessionID string `json:"sessionId,omitempty"`
Name string `json:"name,omitempty"`
Cwd string `json:"cwd,omitempty"`
PermissionClass PermissionClass `json:"permissionClass"`
}
Identity is the model-independent identity published by one live Zero process. SessionID and Name are updated when the TUI creates, resumes, or renames its active session.
type InboundMessage ¶
type InboundMessage struct {
ID string
From Peer
Body string
Summary string
ReceivedAt time.Time
RequiresApproval bool
HoldCause HoldCause
HopChain []string
}
InboundMessage is delivered to the receiving application. RequiresApproval is true when local policy requires the user to approve delivery.
type InboundPolicy ¶
type InboundPolicy string
const ( InboundPolicyParity InboundPolicy = "" InboundPolicyAccept InboundPolicy = "accept" InboundPolicyHold InboundPolicy = "hold" InboundPolicyRefuse InboundPolicy = "refuse" )
type Peer ¶
type Peer struct {
Identity
Endpoint string `json:"endpoint"`
PID int `json:"pid"`
StartedAt time.Time `json:"startedAt"`
UpdatedAt time.Time `json:"updatedAt"`
Ref string `json:"ref"`
}
Peer is one reachable local Zero session.
type PermissionClass ¶
type PermissionClass string
const ( PermissionPrompting PermissionClass = "prompting" PermissionBypass PermissionClass = "bypass" )
type SendResult ¶
type SendResult struct {
MessageID string
Peer Peer
Status DeliveryStatus
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service owns one live peer endpoint plus the registry used to discover other local Zero sessions. The transport is platform-specific, while framing, identity resolution, limits, and delivery policy remain shared.
func (*Service) ResolveHeld ¶
func (service *Service) ResolveHeld(ctx context.Context, messageID string, status DeliveryStatus) error
ResolveHeld settles a message that was parked for local approval and sends a terminal receipt back to its sender. Repeated or stale decisions are ignored.
func (*Service) SetHeldEvictionHandler ¶
func (service *Service) SetHeldEvictionHandler(handler HeldEvictionHandler)
func (*Service) SetHeldReleaseHandler ¶
func (service *Service) SetHeldReleaseHandler(handler HeldReleaseHandler)
func (*Service) SetStatusHandler ¶
func (service *Service) SetStatusHandler(handler StatusHandler)
func (*Service) UpdateIdentity ¶
type StatusEvent ¶
type StatusEvent struct {
MessageID string
Peer Peer
Status DeliveryStatus
}
type StatusHandler ¶
type StatusHandler func(StatusEvent)