Documentation
¶
Index ¶
- Constants
- type FileStore
- func (f *FileStore) CreateSession(_ context.Context, meta schema.SessionMeta) (*schema.Session, error)
- func (f *FileStore) DeleteSession(_ context.Context, id string) error
- func (f *FileStore) GetSession(_ context.Context, id string) (*schema.Session, error)
- func (f *FileStore) ListSessions(_ context.Context, req schema.ListSessionRequest) (*schema.ListSessionResponse, error)
- func (f *FileStore) UpdateSession(_ context.Context, id string, meta schema.SessionMeta) (*schema.Session, error)
- func (f *FileStore) WriteSession(s *schema.Session) error
- type MemoryAgentStore
- func (m *MemoryAgentStore) CreateAgent(_ context.Context, meta schema.AgentMeta) (*schema.Agent, error)
- func (m *MemoryAgentStore) DeleteAgent(_ context.Context, id string) error
- func (m *MemoryAgentStore) GetAgent(_ context.Context, id string) (*schema.Agent, error)
- func (m *MemoryAgentStore) ListAgents(_ context.Context, req schema.ListAgentRequest) (*schema.ListAgentResponse, error)
- func (m *MemoryAgentStore) UpdateAgent(_ context.Context, id string, meta schema.AgentMeta) (*schema.Agent, error)
- type MemorySessionStore
- func (m *MemorySessionStore) CreateSession(_ context.Context, meta schema.SessionMeta) (*schema.Session, error)
- func (m *MemorySessionStore) DeleteSession(_ context.Context, id string) error
- func (m *MemorySessionStore) GetSession(_ context.Context, id string) (*schema.Session, error)
- func (m *MemorySessionStore) ListSessions(_ context.Context, req schema.ListSessionRequest) (*schema.ListSessionResponse, error)
- func (m *MemorySessionStore) UpdateSession(_ context.Context, id string, meta schema.SessionMeta) (*schema.Session, error)
- func (m *MemorySessionStore) WriteSession(_ *schema.Session) error
Constants ¶
const ( DirPerm os.FileMode = 0o700 // Directory permission for session store FilePerm os.FileMode = 0o600 // File permission for session files )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
FileStore is a file-backed implementation of Store. Each session is stored as {id}.json in a directory. It is safe for concurrent use.
func NewFileStore ¶
NewFileStore creates a new file-backed session store in the given directory. The directory is created if it does not exist.
func (*FileStore) CreateSession ¶
func (f *FileStore) CreateSession(_ context.Context, meta schema.SessionMeta) (*schema.Session, error)
CreateSession creates a new session with a unique ID, writes it to disk, and returns it.
func (*FileStore) DeleteSession ¶
DeleteSession removes a session file by ID.
func (*FileStore) GetSession ¶
GetSession retrieves a session by ID from disk.
func (*FileStore) ListSessions ¶
func (f *FileStore) ListSessions(_ context.Context, req schema.ListSessionRequest) (*schema.ListSessionResponse, error)
ListSessions returns sessions from disk, ordered by last modified time (most recent first), with pagination support.
type MemoryAgentStore ¶
type MemoryAgentStore struct {
// contains filtered or unexported fields
}
MemoryAgentStore is an in-memory implementation of AgentStore. It is safe for concurrent use.
func NewMemoryAgentStore ¶
func NewMemoryAgentStore() *MemoryAgentStore
NewMemoryAgentStore creates a new empty in-memory agent store.
func (*MemoryAgentStore) CreateAgent ¶
func (m *MemoryAgentStore) CreateAgent(_ context.Context, meta schema.AgentMeta) (*schema.Agent, error)
CreateAgent creates a new agent with a unique ID and returns it. The agent name must be unique across all agents.
func (*MemoryAgentStore) DeleteAgent ¶
func (m *MemoryAgentStore) DeleteAgent(_ context.Context, id string) error
DeleteAgent removes an agent by ID, or all agents with the given name. Returns an error if no matching agent is found.
func (*MemoryAgentStore) GetAgent ¶
GetAgent retrieves an agent by ID or name. If a matching ID is found it is returned directly. Otherwise, the store looks up the name in the name index and returns the latest version (highest version number) for that name.
func (*MemoryAgentStore) ListAgents ¶
func (m *MemoryAgentStore) ListAgents(_ context.Context, req schema.ListAgentRequest) (*schema.ListAgentResponse, error)
ListAgents returns agents ordered by creation time (most recent first), with pagination support. When filtered by name, all versions for that name are returned. Otherwise only the latest version of each agent is returned.
func (*MemoryAgentStore) UpdateAgent ¶
func (m *MemoryAgentStore) UpdateAgent(_ context.Context, id string, meta schema.AgentMeta) (*schema.Agent, error)
UpdateAgent creates a new version of an existing agent. The id parameter can be an agent ID or name. If the metadata is identical to the current version, the existing agent is returned unchanged (no-op). Otherwise a new agent is stored with a new UUID, the same name, and an incremented version number. The entire read-modify-write sequence is atomic.
type MemorySessionStore ¶
type MemorySessionStore struct {
// contains filtered or unexported fields
}
MemorySessionStore is an in-memory implementation of Store. It is safe for concurrent use.
func NewMemorySessionStore ¶
func NewMemorySessionStore() *MemorySessionStore
NewMemorySessionStore creates a new empty in-memory session store.
func (*MemorySessionStore) CreateSession ¶
func (m *MemorySessionStore) CreateSession(_ context.Context, meta schema.SessionMeta) (*schema.Session, error)
CreateSession creates a new session with a unique ID and returns it.
func (*MemorySessionStore) DeleteSession ¶
func (m *MemorySessionStore) DeleteSession(_ context.Context, id string) error
DeleteSession removes a session by ID.
func (*MemorySessionStore) GetSession ¶
GetSession retrieves a session by ID.
func (*MemorySessionStore) ListSessions ¶
func (m *MemorySessionStore) ListSessions(_ context.Context, req schema.ListSessionRequest) (*schema.ListSessionResponse, error)
ListSessions returns sessions, ordered by last modified time (most recent first), with pagination support.
func (*MemorySessionStore) UpdateSession ¶
func (m *MemorySessionStore) UpdateSession(_ context.Context, id string, meta schema.SessionMeta) (*schema.Session, error)
UpdateSession applies non-zero fields from meta to the session identified by id.
func (*MemorySessionStore) WriteSession ¶
func (m *MemorySessionStore) WriteSession(_ *schema.Session) error
WriteSession is a no-op for the memory store since sessions are held as pointers in memory and mutations are visible immediately.