Documentation
¶
Overview ¶
Package nativesessions shares on-demand native attachments between viewers. It owns no harness processes or transcript files, and does no idle scanning.
Index ¶
- type Event
- type Frame
- type Service
- func (s *Service) Action(ctx context.Context, ad agent.Adapter, q agent.NativeSessionQuery, ...) (agent.NativeSessionReceipt, error)
- func (s *Service) Activity(ctx context.Context, ad agent.Adapter, q agent.NativeSessionQuery) (agent.SessionActivity, error)
- func (s *Service) Close()
- func (s *Service) RunTurn(ctx context.Context, ad agent.Adapter, in agent.TurnInput, emit agent.Emit) (agent.TurnResult, error)
- func (s *Service) Subscribe(ctx context.Context, ad agent.Adapter, q agent.NativeSessionQuery, ...) (Snapshot, []Event, <-chan Event, func(), error)
- type Snapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
ConnectionID string `json:"connectionId"`
Sequence int64 `json:"sequence"`
agent.NativeSessionUpdate
}
type Frame ¶
type Frame struct {
Type string `json:"type"` // snapshot | resume | update
Snapshot *Snapshot `json:"snapshot,omitempty"`
Update *Event `json:"update,omitempty"`
}
Frame is the SDK/SSE envelope. A resume frame acknowledges a replay cursor; unlike a snapshot, it must not replace the client's existing projection.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) Action ¶
func (s *Service) Action(ctx context.Context, ad agent.Adapter, q agent.NativeSessionQuery, action agent.NativeSessionAction) (agent.NativeSessionReceipt, error)
func (*Service) Activity ¶
func (s *Service) Activity(ctx context.Context, ad agent.Adapter, q agent.NativeSessionQuery) (agent.SessionActivity, error)
func (*Service) RunTurn ¶
func (s *Service) RunTurn(ctx context.Context, ad agent.Adapter, in agent.TurnInput, emit agent.Emit) (agent.TurnResult, error)
RunTurn lets existing /turns callers use an already-running owner. The same attachment serves the live-session API, so opening another viewer adds no CLI process. The supervisor still owns the request receipt and its detached run.
func (*Service) Subscribe ¶
func (s *Service) Subscribe(ctx context.Context, ad agent.Adapter, q agent.NativeSessionQuery, connectionID string, after int64) (Snapshot, []Event, <-chan Event, func(), error)
Subscribe registers the viewer and reads its baseline under the same lock as publication. A stale/evicted cursor gets a replacement snapshot, never a gap.
type Snapshot ¶
type Snapshot struct {
ConnectionID string `json:"connectionId"`
Sequence int64 `json:"sequence"`
TurnID string `json:"turnId,omitempty"`
Activity agent.SessionActivity `json:"activity"`
Parts []agent.Part `json:"parts"`
Inputs []agent.UserInput `json:"inputs"`
HistoryRequired bool `json:"historyRequired,omitempty"`
Partial bool `json:"partial,omitempty"`
Replay bool `json:"replay,omitempty"` // retain the previous projection and apply replay events
}