externalcli

package
v0.1.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package externalcli 将外部代理 CLI 适配到 Leros agent.Runner 边界。

Index

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

Get 返回对应键的提供者会话绑定。

func (*InMemoryProviderSessionStore) MarkFailed

MarkFailed 将提供者会话绑定标记为失败。

func (*InMemoryProviderSessionStore) Upsert

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 NewRunner

func NewRunner(name string, engine engines.Engine) (*Runner, error)

NewRunner 创建外部 CLI 运行器。

func (*Runner) Run

Run 通过外部 CLI 引擎执行标准化请求。

func (*Runner) SetApprovalHandler

func (r *Runner) SetApprovalHandler(handler engines.ApprovalHandler)

SetApprovalHandler 设置审批处理器,用于 on-request 和 auto 模式。

func (*Runner) SetMCPServers added in v0.1.5

func (r *Runner) SetMCPServers(cfgs []engines.MCPServerConfig)

SetMCPServers 设置 MCP 服务配置,用于后续 Run() 时传入引擎。

func (*Runner) SetSessionStore

func (r *Runner) SetSessionStore(store ProviderSessionStore)

SetSessionStore 替换用于外部 CLI 恢复的提供者会话存储。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL