Documentation
¶
Index ¶
- Variables
- func DecodeValue(src any, dest any) error
- type JSONStore
- func (js *JSONStore) Delete(ctx context.Context, collection, key string) error
- func (js *JSONStore) DeleteAgent(ctx context.Context, agentID string) error
- func (js *JSONStore) Exists(ctx context.Context, collection, key string) (bool, error)
- func (js *JSONStore) Get(ctx context.Context, collection, key string, dest any) error
- func (js *JSONStore) List(ctx context.Context, collection string) ([]any, error)
- func (js *JSONStore) ListAgents(ctx context.Context) ([]string, error)
- func (js *JSONStore) ListSnapshots(ctx context.Context, agentID string) ([]types.Snapshot, error)
- func (js *JSONStore) LoadInfo(ctx context.Context, agentID string) (*types.AgentInfo, error)
- func (js *JSONStore) LoadMessages(ctx context.Context, agentID string) ([]types.Message, error)
- func (js *JSONStore) LoadSnapshot(ctx context.Context, agentID string, snapshotID string) (*types.Snapshot, error)
- func (js *JSONStore) LoadTodos(ctx context.Context, agentID string) (any, error)
- func (js *JSONStore) LoadToolCallRecords(ctx context.Context, agentID string) ([]types.ToolCallRecord, error)
- func (js *JSONStore) SaveInfo(ctx context.Context, agentID string, info types.AgentInfo) error
- func (js *JSONStore) SaveMessages(ctx context.Context, agentID string, messages []types.Message) error
- func (js *JSONStore) SaveSnapshot(ctx context.Context, agentID string, snapshot types.Snapshot) error
- func (js *JSONStore) SaveTodos(ctx context.Context, agentID string, todos any) error
- func (js *JSONStore) SaveToolCallRecords(ctx context.Context, agentID string, records []types.ToolCallRecord) error
- func (js *JSONStore) Set(ctx context.Context, collection, key string, value any) error
- type Store
- type StoreError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound 资源未找到错误 ErrNotFound = &StoreError{Code: "not_found", Message: "resource not found"} // ErrAlreadyExists 资源已存在错误 ErrAlreadyExists = &StoreError{Code: "already_exists", Message: "resource already exists"} )
Functions ¶
Types ¶
type JSONStore ¶
type JSONStore struct {
// contains filtered or unexported fields
}
JSONStore JSON文件存储实现
func (*JSONStore) DeleteAgent ¶
DeleteAgent 删除Agent所有数据
func (*JSONStore) ListAgents ¶
ListAgents 列出所有Agent
func (*JSONStore) ListSnapshots ¶
ListSnapshots 列出快照
func (*JSONStore) LoadMessages ¶
LoadMessages 加载消息列表
func (*JSONStore) LoadSnapshot ¶
func (js *JSONStore) LoadSnapshot(ctx context.Context, agentID string, snapshotID string) (*types.Snapshot, error)
LoadSnapshot 加载快照
func (*JSONStore) LoadToolCallRecords ¶
func (js *JSONStore) LoadToolCallRecords(ctx context.Context, agentID string) ([]types.ToolCallRecord, error)
LoadToolCallRecords 加载工具调用记录
func (*JSONStore) SaveMessages ¶
func (js *JSONStore) SaveMessages(ctx context.Context, agentID string, messages []types.Message) error
SaveMessages 保存消息列表
func (*JSONStore) SaveSnapshot ¶
func (js *JSONStore) SaveSnapshot(ctx context.Context, agentID string, snapshot types.Snapshot) error
SaveSnapshot 保存快照
func (*JSONStore) SaveToolCallRecords ¶
func (js *JSONStore) SaveToolCallRecords(ctx context.Context, agentID string, records []types.ToolCallRecord) error
SaveToolCallRecords 保存工具调用记录
type Store ¶
type Store interface {
// SaveMessages 保存消息列表
SaveMessages(ctx context.Context, agentID string, messages []types.Message) error
// LoadMessages 加载消息列表
LoadMessages(ctx context.Context, agentID string) ([]types.Message, error)
// SaveToolCallRecords 保存工具调用记录
SaveToolCallRecords(ctx context.Context, agentID string, records []types.ToolCallRecord) error
// LoadToolCallRecords 加载工具调用记录
LoadToolCallRecords(ctx context.Context, agentID string) ([]types.ToolCallRecord, error)
// SaveSnapshot 保存快照
SaveSnapshot(ctx context.Context, agentID string, snapshot types.Snapshot) error
// LoadSnapshot 加载快照
LoadSnapshot(ctx context.Context, agentID string, snapshotID string) (*types.Snapshot, error)
// ListSnapshots 列出快照
ListSnapshots(ctx context.Context, agentID string) ([]types.Snapshot, error)
// SaveInfo 保存Agent元信息
SaveInfo(ctx context.Context, agentID string, info types.AgentInfo) error
// LoadInfo 加载Agent元信息
LoadInfo(ctx context.Context, agentID string) (*types.AgentInfo, error)
// SaveTodos 保存Todo列表
SaveTodos(ctx context.Context, agentID string, todos any) error
// LoadTodos 加载Todo列表
LoadTodos(ctx context.Context, agentID string) (any, error)
// DeleteAgent 删除Agent所有数据
DeleteAgent(ctx context.Context, agentID string) error
// ListAgents 列出所有Agent
ListAgents(ctx context.Context) ([]string, error)
// Get 获取单个资源
Get(ctx context.Context, collection, key string, dest any) error
// Set 设置资源
Set(ctx context.Context, collection, key string, value any) error
// Delete 删除资源
Delete(ctx context.Context, collection, key string) error
// List 列出资源
List(ctx context.Context, collection string) ([]any, error)
// Exists 检查资源是否存在
Exists(ctx context.Context, collection, key string) (bool, error)
}
Store 持久化存储接口
type StoreError ¶
StoreError Store 错误类型
func (*StoreError) Error ¶
func (e *StoreError) Error() string
func (*StoreError) Unwrap ¶
func (e *StoreError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.