agentsync

package
v0.0.62 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureGrokSync

func EnsureGrokSync(ctx context.Context, opts GrokSyncOptions) error

EnsureGrokSync starts (or reuses) a single persistent grok sync worker per session.

func GrokSyncWorkerActive

func GrokSyncWorkerActive(runner, sessionID string) bool

GrokSyncWorkerActive reports whether a grok sync worker is running for the session. It checks the in-process registry and, when absent, whether another process holds the per-session grok-sync.lock (web server subprocess integration tests).

func GrokSyncWorkerCount

func GrokSyncWorkerCount() int

GrokSyncWorkerCount returns the number of active grok sync workers.

func ReconcileOnce

func ReconcileOnce(ctx context.Context, opts ReconcileOptions) error

ReconcileOnce attempts to heal a single session or scan candidates when SessionID is empty.

func StartReconciler

func StartReconciler(ctx context.Context, interval time.Duration, opts ReconcileOptions)

StartReconciler runs reconcile passes on a fixed interval until ctx is cancelled.

func StopGrokSync

func StopGrokSync(runner, sessionID string) error

StopGrokSync stops the grok sync worker for a session, if running.

func TryAcquireSessionLock

func TryAcquireSessionLock(sessionDir string) (release func(), acquired bool, err error)

TryAcquireSessionLock attempts a non-blocking exclusive flock on grok-sync.lock. When acquired is true, release must be called to unlock.

Types

type GrokSyncOptions

type GrokSyncOptions struct {
	GrokHome         string
	InitialPrompt    string
	SessionCreatedAt time.Time
	Workspace        string
	Runner           string
	SessionID        string
	GrokSessionID    string
	UpdatesPath      string
	Sink             GrokSyncSink
}

GrokSyncOptions configures a persistent grok sync worker.

type GrokSyncSink

type GrokSyncSink interface {
	SessionDir() string
	AppendEvent(ev types.AgentEvent) error
	LoadCheckpoint() (GrokSyncState, error)
	SaveCheckpoint(GrokSyncState) error
	OnTurnCompleted() error
	UpdateRunnerSessionID(runnerSessionID string) error
}

GrokSyncSink persists grok sync worker output and checkpoints.

func NewFileGrokSyncSink

func NewFileGrokSyncSink(sessionDir, grokSessionID, updatesPath string) GrokSyncSink

NewFileGrokSyncSink writes events.jsonl and grok-sync.json under sessionDir.

func NewRunGrokSyncSink

func NewRunGrokSyncSink(emit func(types.AgentEvent) error, checkpt *StoreGrokSyncSink) GrokSyncSink

NewRunGrokSyncSink wraps a store sink and optionally forwards emitted events.

type GrokSyncState

type GrokSyncState struct {
	GrokSessionID string `json:"grok_session_id"`
	UpdatesPath   string `json:"updates_path"`
	UpdatesOffset int64  `json:"updates_offset"`
	TurnIndex     int    `json:"turn_index"`
}

GrokSyncState is the persisted grok updates tail checkpoint.

type ReconcileOptions

type ReconcileOptions struct {
	Home      string
	GrokHome  string
	Runner    string
	SessionID string
}

ReconcileOptions configures a reconcile pass.

type StoreGrokSyncSink

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

StoreGrokSyncSink persists grok sync output via agentstorage.Store.

func NewStoreGrokSyncSink

func NewStoreGrokSyncSink(store agentstorage.Store, runner, sessionID, grokSessionID, updatesPath string) *StoreGrokSyncSink

NewStoreGrokSyncSink creates a store-backed GrokSyncSink for a session.

func (*StoreGrokSyncSink) AppendEvent

func (s *StoreGrokSyncSink) AppendEvent(ev types.AgentEvent) error

func (*StoreGrokSyncSink) LoadCheckpoint

func (s *StoreGrokSyncSink) LoadCheckpoint() (GrokSyncState, error)

func (*StoreGrokSyncSink) OnTurnCompleted

func (s *StoreGrokSyncSink) OnTurnCompleted() error

func (*StoreGrokSyncSink) SaveCheckpoint

func (s *StoreGrokSyncSink) SaveCheckpoint(st GrokSyncState) error

func (*StoreGrokSyncSink) SessionDir

func (s *StoreGrokSyncSink) SessionDir() string

func (*StoreGrokSyncSink) UpdateRunnerSessionID

func (s *StoreGrokSyncSink) UpdateRunnerSessionID(runnerSessionID string) error

Jump to

Keyboard shortcuts

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