Documentation
¶
Index ¶
- func EnsureGrokSync(ctx context.Context, opts GrokSyncOptions) error
- func GrokSyncWorkerActive(runner, sessionID string) bool
- func GrokSyncWorkerCount() int
- func ReconcileOnce(ctx context.Context, opts ReconcileOptions) error
- func StartReconciler(ctx context.Context, interval time.Duration, opts ReconcileOptions)
- func StopGrokSync(runner, sessionID string) error
- func TryAcquireSessionLock(sessionDir string) (release func(), acquired bool, err error)
- type GrokSyncOptions
- type GrokSyncSink
- type GrokSyncState
- type ReconcileOptions
- type StoreGrokSyncSink
- func (s *StoreGrokSyncSink) AppendEvent(ev types.AgentEvent) error
- func (s *StoreGrokSyncSink) LoadCheckpoint() (GrokSyncState, error)
- func (s *StoreGrokSyncSink) OnTurnCompleted() error
- func (s *StoreGrokSyncSink) SaveCheckpoint(st GrokSyncState) error
- func (s *StoreGrokSyncSink) SessionDir() string
- func (s *StoreGrokSyncSink) UpdateRunnerSessionID(runnerSessionID string) error
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 ¶
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 ¶
StopGrokSync stops the grok sync worker for a session, if running.
func TryAcquireSessionLock ¶
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 ¶
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