Documentation
¶
Overview ¶
Package externalcli 将外部代理 CLI 适配到 Leros agent.Runner 边界。
Index ¶
- func SetDefaultProviderSessionStore(store ProviderSessionStore)
- type InMemoryProviderSessionStore
- func (s *InMemoryProviderSessionStore) Get(_ context.Context, key ProviderSessionKey) (*ProviderSessionBinding, error)
- func (s *InMemoryProviderSessionStore) MarkFailed(_ context.Context, key ProviderSessionKey, reason string) error
- func (s *InMemoryProviderSessionStore) Upsert(_ context.Context, binding *ProviderSessionBinding) error
- type ProviderSessionBinding
- type ProviderSessionKey
- type ProviderSessionMetadata
- type ProviderSessionStore
- type Runner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDefaultProviderSessionStore ¶
func SetDefaultProviderSessionStore(store ProviderSessionStore)
SetDefaultProviderSessionStore 替换包级提供者会话存储(主要用于测试)。
Types ¶
type InMemoryProviderSessionStore ¶
type InMemoryProviderSessionStore struct {
// contains filtered or unexported fields
}
InMemoryProviderSessionStore 在进程内存中存储提供者会话绑定。
func NewInMemoryProviderSessionStore ¶
func NewInMemoryProviderSessionStore() *InMemoryProviderSessionStore
NewInMemoryProviderSessionStore 创建内存中的提供者会话存储。
func (*InMemoryProviderSessionStore) Get ¶
func (s *InMemoryProviderSessionStore) Get(_ context.Context, key ProviderSessionKey) (*ProviderSessionBinding, error)
Get 返回对应键的提供者会话绑定。
func (*InMemoryProviderSessionStore) MarkFailed ¶
func (s *InMemoryProviderSessionStore) MarkFailed(_ context.Context, key ProviderSessionKey, reason string) error
MarkFailed 将提供者会话绑定标记为失败。
func (*InMemoryProviderSessionStore) Upsert ¶
func (s *InMemoryProviderSessionStore) Upsert(_ context.Context, binding *ProviderSessionBinding) error
Upsert 创建或替换提供者会话绑定。
type ProviderSessionBinding ¶
type ProviderSessionBinding struct {
InternalSessionID string
Provider string
ProviderSessionID string
WorkDir string
AssistantID string
Status string
LastError string
CreatedAt time.Time
UpdatedAt time.Time
}
ProviderSessionBinding 将 Leros 会话映射到提供者原生 CLI 会话。
type ProviderSessionKey ¶
type ProviderSessionKey struct {
InternalSessionID string
Provider string
WorkDir string
AssistantID string
}
ProviderSessionKey 标识一个外部 CLI 会话绑定。
type ProviderSessionMetadata ¶
type ProviderSessionMetadata struct {
Provider string `json:"provider"`
ProviderSessionID string `json:"provider_session_id"`
CreatedAt time.Time `json:"created_at"`
}
ProviderSessionMetadata 在 Session.Metadata 中存储提供者原生会话信息。
type ProviderSessionStore ¶
type ProviderSessionStore interface {
Get(ctx context.Context, key ProviderSessionKey) (*ProviderSessionBinding, error)
Upsert(ctx context.Context, binding *ProviderSessionBinding) error
MarkFailed(ctx context.Context, key ProviderSessionKey, reason string) error
}
ProviderSessionStore 持久化提供者会话绑定,用于外部 CLI 恢复。
func DefaultProviderSessionStore ¶
func DefaultProviderSessionStore() ProviderSessionStore
DefaultProviderSessionStore 返回包级提供者会话存储,首次调用时自动初始化 SQLite。
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner 将外部代理 CLI 引擎适配到代理运行器边界。
func (*Runner) SetApprovalHandler ¶
func (r *Runner) SetApprovalHandler(handler engines.ApprovalHandler)
SetApprovalHandler 设置审批处理器,用于 on-request 和 auto 模式。
func (*Runner) SetSessionStore ¶
func (r *Runner) SetSessionStore(store ProviderSessionStore)
SetSessionStore 替换用于外部 CLI 恢复的提供者会话存储。
Click to show internal directories.
Click to hide internal directories.