Documentation
¶
Overview ¶
Package trajectory defines durable, replayable run events independently of transport delivery or user-interface activity.
Index ¶
- Variables
- type Emitter
- type Event
- type MemoryStore
- func (s *MemoryStore) Ack(ctx context.Context, sessionID, runID string, sequence uint64) (StreamState, error)
- func (s *MemoryStore) Append(_ context.Context, event Event) (Event, error)
- func (s *MemoryStore) Replay(_ context.Context, sessionID, runID string, after uint64, limit int) ([]Event, error)
- func (s *MemoryStore) SetDegraded(ctx context.Context, sessionID, runID, reason string) error
- func (s *MemoryStore) State(ctx context.Context, sessionID, runID string) (StreamState, error)
- type Redactor
- type Reliability
- type ReplayStore
- type Store
- type StreamState
Constants ¶
This section is empty.
Variables ¶
var ErrCursorExpired = errors.New("trajectory cursor is older than retained history")
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
RunID string `json:"run_id"`
NodeID string `json:"node_id,omitempty"`
Sequence uint64 `json:"sequence"`
Type string `json:"type"`
At time.Time `json:"at"`
Reliability Reliability `json:"reliability"`
Data map[string]interface{} `json:"data,omitempty"`
}
Event is one sanitized operational fact. Data must not contain prompts, credentials, or complete raw tool output.
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore is a concurrency-safe reference store.
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
func NewMemoryStoreWithRetention ¶
func NewMemoryStoreWithRetention(maxEvents int) *MemoryStore
func (*MemoryStore) Ack ¶
func (s *MemoryStore) Ack(ctx context.Context, sessionID, runID string, sequence uint64) (StreamState, error)
func (*MemoryStore) SetDegraded ¶
func (s *MemoryStore) SetDegraded(ctx context.Context, sessionID, runID, reason string) error
func (*MemoryStore) State ¶
func (s *MemoryStore) State(ctx context.Context, sessionID, runID string) (StreamState, error)
type Reliability ¶
type Reliability string
const ( ReliabilityDurable Reliability = "durable" ReliabilityDegraded Reliability = "degraded" )
type ReplayStore ¶
type ReplayStore interface {
Store
Ack(context.Context, string, string, uint64) (StreamState, error)
State(context.Context, string, string) (StreamState, error)
SetDegraded(context.Context, string, string, string) error
}
ReplayStore adds acknowledgement, retention, and authoritative refresh metadata without coupling the durable event log to a transport.
type Store ¶
type Store interface {
Append(context.Context, Event) (Event, error)
Replay(context.Context, string, string, uint64, int) ([]Event, error)
}
Store appends before delivery and replays strictly after a cursor.
type StreamState ¶
type StreamState struct {
EarliestSequence uint64 `json:"earliest_sequence"`
HeadSequence uint64 `json:"head_sequence"`
AckedSequence uint64 `json:"acked_sequence"`
Reliability Reliability `json:"reliability"`
LastError string `json:"last_error,omitempty"`
}