Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrSessionNotFound = errors.New("session not found")
ErrSessionNotFound is returned by LoadSession when the requested session does not exist.
Functions ¶
This section is empty.
Types ¶
type BaseStore ¶
type BaseStore interface {
SaveSession(context.Context, string, SessionCheckpoint) error
LoadSession(context.Context, string) (SessionCheckpoint, error)
}
BaseStore is the minimal persistence interface for agent harness session state.
Implementations included in this package:
- InMemoryStore — sessions live in memory, lost on restart.
- PostgresStore — sessions persisted via PostgreSQL/pgx.
Users may provide their own implementation (e.g. Redis, SQLite, custom DB). Wire-protocol session envelopes are not part of this API.
type InMemoryStore ¶
type InMemoryStore struct {
// contains filtered or unexported fields
}
InMemoryStore implements BaseStore entirely in memory. Sessions are lost when the process exits.
func NewInMemoryStore ¶
func NewInMemoryStore() *InMemoryStore
NewInMemoryStore creates an empty in-memory session store.
func (*InMemoryStore) LoadSession ¶
func (s *InMemoryStore) LoadSession(_ context.Context, sessionID string) (SessionCheckpoint, error)
LoadSession retrieves the session checkpoint for the given sessionID.
func (*InMemoryStore) SaveSession ¶
func (s *InMemoryStore) SaveSession(_ context.Context, sessionID string, checkpoint SessionCheckpoint) error
SaveSession stores the session checkpoint for the given sessionID.
type PendingToolCall ¶
type PostgresStore ¶
type PostgresStore struct {
// contains filtered or unexported fields
}
PostgresStore implements BaseStore against a Postgres connection via pgx.
func NewPostgresStore ¶
func NewPostgresStore(conn *pgx.Conn) *PostgresStore
NewPostgresStore wraps an existing pgx connection.
func (*PostgresStore) LoadSession ¶
func (s *PostgresStore) LoadSession(ctx context.Context, sessionID string) (SessionCheckpoint, error)
func (*PostgresStore) SaveSession ¶
func (s *PostgresStore) SaveSession(ctx context.Context, sessionID string, checkpoint SessionCheckpoint) error
type SessionCheckpoint ¶
type SessionCheckpoint struct {
ContextWindow []*streaming.Message `json:"contextWindow"`
State sessionState `json:"state"`
}
SessionCheckpoint is the agent harness checkpoint blob. Wire protocols (ACP, …) must not store protocol envelopes here — use a ProtocolWireStore (or equivalent) owned by the protocol.