events

package
v0.0.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GenesisHash = mustEventHashFromBytes(nil)

Functions

func ListSessions

func ListSessions(metadataDir string) ([]primitives.SessionID, error)

func StreamPath

func StreamPath(metadataDir string, sessionID primitives.SessionID, streamID primitives.EventStreamID) string

func WorkspaceStreamPath

func WorkspaceStreamPath(metadataDir string, worktreeID primitives.WorktreeID, streamID primitives.EventStreamID) string

func WriteStreamMetadata

func WriteStreamMetadata(metadataDir string, metadata StreamMetadata) error

func WriteWorkspaceStreamMetadata

func WriteWorkspaceStreamMetadata(metadataDir string, metadata StreamMetadata) error

Types

type AppendContext

type AppendContext struct {
	Seq            primitives.EventSeq
	PreviousEvents []Event
}

type AppendInput

type AppendInput struct {
	SessionID    primitives.SessionID
	TurnID       *primitives.TurnID
	Type         primitives.EventType
	Adapter      primitives.AdapterName
	Time         primitives.Timestamp
	SourceID     string
	RawRef       string
	Payload      json.RawMessage
	BuildPayload func(AppendContext) (json.RawMessage, error)
}

type DurableStream

type DurableStream struct {
	SessionID  primitives.SessionID
	StreamID   primitives.EventStreamID
	RepoID     primitives.RepoID
	WorktreeID primitives.WorktreeID
	ProducerID primitives.EventProducerID
	Path       string
	Legacy     bool
	ByteSHA256 string
	ByteCount  int64
	Events     []Event
	Workspace  bool
}

func ListDurableStreams

func ListDurableStreams(metadataDir string) ([]DurableStream, error)

type Event

type Event struct {
	Version    int                      `json:"v"`
	RepoID     primitives.RepoID        `json:"repo_id,omitempty"`
	WorktreeID primitives.WorktreeID    `json:"worktree_id,omitempty"`
	StreamID   primitives.EventStreamID `json:"stream_id,omitempty"`
	Seq        primitives.EventSeq      `json:"seq"`
	SessionID  primitives.SessionID     `json:"session_id"`
	TurnID     *primitives.TurnID       `json:"turn_id,omitempty"`
	Type       primitives.EventType     `json:"type"`
	Adapter    primitives.AdapterName   `json:"adapter,omitempty"`
	Time       primitives.Timestamp     `json:"time"`
	SourceID   string                   `json:"source_id,omitempty"`
	RawRef     string                   `json:"raw_ref,omitempty"`
	PrevHash   primitives.EventHash     `json:"prev_hash"`
	Payload    json.RawMessage          `json:"payload"`
	Hash       primitives.EventHash     `json:"hash"`
}

type Log

type Log struct {
	Dir           string
	WorkspaceRoot string
	RepoID        primitives.RepoID
	StoreID       primitives.StoreID
	WorktreeID    primitives.WorktreeID
	ProducerID    primitives.EventProducerID
	Aggregate     bool
}

func Open

func Open(metadataDir string) Log

func OpenFor

func OpenFor(metadataDir, workspaceRoot string, repoID primitives.RepoID, storeID primitives.StoreID, worktreeID primitives.WorktreeID, producerID primitives.EventProducerID) Log

func (Log) Append

func (log Log) Append(input AppendInput) (Event, error)

func (Log) ContainsSourceID

func (log Log) ContainsSourceID(sessionID primitives.SessionID, sourceID string) (bool, error)

func (Log) FindSourceID

func (log Log) FindSourceID(sessionID primitives.SessionID, sourceID string) (Event, bool, error)

func (Log) ListSessions

func (log Log) ListSessions() ([]primitives.SessionID, error)

func (Log) Read

func (log Log) Read(sessionID primitives.SessionID) ([]Event, error)

func (Log) RecoverTrailingPartial

func (log Log) RecoverTrailingPartial(sessionID primitives.SessionID) (bool, error)

func (Log) Verify

func (log Log) Verify(sessionID primitives.SessionID) error

type StreamMetadata

type StreamMetadata struct {
	Version    int                        `json:"version"`
	StreamID   primitives.EventStreamID   `json:"stream_id"`
	ProducerID primitives.EventProducerID `json:"event_producer_id"`
	RepoID     primitives.RepoID          `json:"repo_id"`
	WorktreeID primitives.WorktreeID      `json:"worktree_id"`
	SessionID  primitives.SessionID       `json:"session_id"`
	CreatedAt  string                     `json:"created_at"`
}

Jump to

Keyboard shortcuts

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