Documentation
¶
Index ¶
- Constants
- type FileAgentStore
- func (f *FileAgentStore) CreateAgent(_ context.Context, meta schema.AgentMeta) (*schema.Agent, error)
- func (f *FileAgentStore) DeleteAgent(_ context.Context, id string) error
- func (f *FileAgentStore) GetAgent(_ context.Context, id string) (*schema.Agent, error)
- func (f *FileAgentStore) ListAgents(_ context.Context, req schema.ListAgentRequest) (*schema.ListAgentResponse, error)
- func (f *FileAgentStore) UpdateAgent(_ context.Context, id string, meta schema.AgentMeta) (*schema.Agent, error)
- type FileSessionStore
- func (f *FileSessionStore) CreateSession(_ context.Context, meta schema.SessionMeta) (*schema.Session, error)
- func (f *FileSessionStore) DeleteSession(_ context.Context, id string) error
- func (f *FileSessionStore) GetSession(_ context.Context, id string) (*schema.Session, error)
- func (f *FileSessionStore) ListSessions(_ context.Context, req schema.ListSessionRequest) (*schema.ListSessionResponse, error)
- func (f *FileSessionStore) UpdateSession(_ context.Context, id string, meta schema.SessionMeta) (*schema.Session, error)
- func (f *FileSessionStore) 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 store directories FilePerm os.FileMode = 0o600 // File permission for store files )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileAgentStore ¶ added in v0.3.1
type FileAgentStore struct {
// contains filtered or unexported fields
}
FileAgentStore is a file-backed implementation of AgentStore. Each agent version is stored as {id}.json in a directory. It is safe for concurrent use.
func NewFileAgentStore ¶ added in v0.3.1
func NewFileAgentStore(dir string) (*FileAgentStore, error)
NewFileAgentStore creates a new file-backed agent store in the given directory. The directory is created if it does not exist.
func (*FileAgentStore) CreateAgent ¶ added in v0.3.1
func (f *FileAgentStore) CreateAgent(_ context.Context, meta schema.AgentMeta) (*schema.Agent, error)
CreateAgent creates a new agent with a unique ID and version 1, writes it to disk, and returns it.
func (*FileAgentStore) DeleteAgent ¶ added in v0.3.1
func (f *FileAgentStore) DeleteAgent(_ context.Context, id string) error
DeleteAgent removes an agent by ID or name. When a name is provided, all versions of the agent are deleted. Returns an error if no matching agent exists.
func (*FileAgentStore) GetAgent ¶ added in v0.3.1
GetAgent retrieves an agent by ID or name. If a matching ID is found it is returned directly. Otherwise, the store scans all agent files and returns the latest version (highest version number) with the given name.
func (*FileAgentStore) ListAgents ¶ added in v0.3.1
func (f *FileAgentStore) ListAgents(_ context.Context, req schema.ListAgentRequest) (*schema.ListAgentResponse, error)
ListAgents returns agents matching the request, with pagination support. When filtered by name, all matching versions are returned; otherwise only the latest version of each agent is returned.
func (*FileAgentStore) UpdateAgent ¶ added in v0.3.1
func (f *FileAgentStore) UpdateAgent(_ context.Context, id string, meta schema.AgentMeta) (*schema.Agent, error)
UpdateAgent creates a new version of an existing agent with the given metadata changes. 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 written to disk with a new UUID, the same name, and an incremented version number.
type FileSessionStore ¶ added in v0.3.1
type FileSessionStore struct {
// contains filtered or unexported fields
}
FileSessionStore is a file-backed implementation of Store. Each session is stored as {id}.json in a directory. It is safe for concurrent use.
func NewFileSessionStore ¶ added in v0.3.1
func NewFileSessionStore(dir string) (*FileSessionStore, error)
NewFileSessionStore creates a new file-backed session store in the given directory. The directory is created if it does not exist.
func (*FileSessionStore) CreateSession ¶ added in v0.3.1
func (f *FileSessionStore) 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 (*FileSessionStore) DeleteSession ¶ added in v0.3.1
func (f *FileSessionStore) DeleteSession(_ context.Context, id string) error
DeleteSession removes a session file by ID.
func (*FileSessionStore) GetSession ¶ added in v0.3.1
GetSession retrieves a session by ID from disk.
func (*FileSessionStore) ListSessions ¶ added in v0.3.1
func (f *FileSessionStore) 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.
func (*FileSessionStore) UpdateSession ¶ added in v0.3.1
func (f *FileSessionStore) UpdateSession(_ context.Context, id string, meta schema.SessionMeta) (*schema.Session, error)
UpdateSession applies non-zero fields from meta to the session identified by id, persists the result to disk, and returns the updated session.
func (*FileSessionStore) WriteSession ¶ added in v0.3.1
func (f *FileSessionStore) WriteSession(s *schema.Session) error
WriteSession persists a session's current state to disk. This is called after mutations (e.g. Append) to keep the file in sync.
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.