Documentation
¶
Overview ¶
Package runtimehost provides Worker-specific implementations of agent ports.
Index ¶
- type InteractionRouter
- func (r *InteractionRouter) GetApprovalResponder(requestID string) agent.ApprovalResponder
- func (r *InteractionRouter) GetQuestionResponder(requestID string) agent.QuestionResponder
- func (r *InteractionRouter) RequestAnswer(ctx context.Context, req *agent.QuestionRequest) (*agent.QuestionAnswer, error)
- func (r *InteractionRouter) RequestApproval(ctx context.Context, req *agent.ApprovalRequest) (*agent.ApprovalDecision, error)
- func (r *InteractionRouter) ResolveApproval(requestID, action, reason string) error
- func (r *InteractionRouter) ResolveQuestion(requestID string, answers [][]string) error
- func (r *InteractionRouter) SetApprovalResponder(requestID string, responder agent.ApprovalResponder)
- func (r *InteractionRouter) SetQuestionResponder(requestID string, responder agent.QuestionResponder)
- type PendingApproval
- type PendingQuestion
- type SQLiteSessionStore
- func (s *SQLiteSessionStore) Close() error
- func (s *SQLiteSessionStore) GetProviderSession(_ context.Context, key agentrun.ProviderSessionKey) (*agentrun.ProviderSessionBinding, error)
- func (s *SQLiteSessionStore) MarkProviderSessionFailed(_ context.Context, key agentrun.ProviderSessionKey, reason string) error
- func (s *SQLiteSessionStore) UpsertProviderSession(_ context.Context, binding *agentrun.ProviderSessionBinding) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InteractionRouter ¶
type InteractionRouter struct {
// contains filtered or unexported fields
}
InteractionRouter 统一管理审批(approval)和问题(question)类型的待处理交互请求。 通过 channel 桥接前端的 HTTP 回传和引擎的阻塞 goroutine。
func NewInteractionRouter ¶
func NewInteractionRouter() *InteractionRouter
NewInteractionRouter 创建交互路由器。
func (*InteractionRouter) GetApprovalResponder ¶
func (r *InteractionRouter) GetApprovalResponder(requestID string) agent.ApprovalResponder
GetApprovalResponder 获取审批请求对应的 Responder。
func (*InteractionRouter) GetQuestionResponder ¶
func (r *InteractionRouter) GetQuestionResponder(requestID string) agent.QuestionResponder
GetQuestionResponder 获取问题请求对应的 Responder。
func (*InteractionRouter) RequestAnswer ¶
func (r *InteractionRouter) RequestAnswer(ctx context.Context, req *agent.QuestionRequest) (*agent.QuestionAnswer, error)
RequestAnswer 注册 pending question 并阻塞等待前端 HTTP 回传答案。 实现 QuestionHandler 接口。
func (*InteractionRouter) RequestApproval ¶
func (r *InteractionRouter) RequestApproval(ctx context.Context, req *agent.ApprovalRequest) (*agent.ApprovalDecision, error)
RequestApproval 注册 pending approval 并阻塞等待前端 HTTP 回传决策。 实现 ApprovalHandler 接口。
func (*InteractionRouter) ResolveApproval ¶
func (r *InteractionRouter) ResolveApproval(requestID, action, reason string) error
ResolveApproval 由 HTTP handler / worker subscriber 调用,填入前端决策并唤醒阻塞的 goroutine。
func (*InteractionRouter) ResolveQuestion ¶
func (r *InteractionRouter) ResolveQuestion(requestID string, answers [][]string) error
ResolveQuestion 由 HTTP handler / worker subscriber 调用,填入用户答案并唤醒阻塞的 goroutine。
func (*InteractionRouter) SetApprovalResponder ¶
func (r *InteractionRouter) SetApprovalResponder(requestID string, responder agent.ApprovalResponder)
SetApprovalResponder 设置审批请求对应的 Responder。
func (*InteractionRouter) SetQuestionResponder ¶
func (r *InteractionRouter) SetQuestionResponder(requestID string, responder agent.QuestionResponder)
SetQuestionResponder 设置问题请求对应的 Responder。
type PendingApproval ¶
type PendingApproval struct {
Request *agent.ApprovalRequest
Responder agent.ApprovalResponder
ResultCh chan *agent.ApprovalDecision
CreatedAt time.Time
}
PendingApproval represents an approval request waiting for a user decision.
type PendingQuestion ¶
type PendingQuestion struct {
Request *agent.QuestionRequest
Responder agent.QuestionResponder
ResultCh chan *agent.QuestionAnswer
CreatedAt time.Time
}
PendingQuestion 表示一个等待前端回答的问题请求。
type SQLiteSessionStore ¶
type SQLiteSessionStore struct {
// contains filtered or unexported fields
}
SQLiteSessionStore implements agentrun.ProviderSessionStore using a local SQLite database. The database path is injected by the composition root, not resolved internally.
func NewSQLiteSessionStore ¶
func NewSQLiteSessionStore(dbPath string) (*SQLiteSessionStore, error)
NewSQLiteSessionStore opens a SQLite session store at the given path.
func (*SQLiteSessionStore) Close ¶
func (s *SQLiteSessionStore) Close() error
Close closes the underlying database.
func (*SQLiteSessionStore) GetProviderSession ¶
func (s *SQLiteSessionStore) GetProviderSession(_ context.Context, key agentrun.ProviderSessionKey) (*agentrun.ProviderSessionBinding, error)
GetProviderSession implements agentrun.ProviderSessionStore.
func (*SQLiteSessionStore) MarkProviderSessionFailed ¶
func (s *SQLiteSessionStore) MarkProviderSessionFailed(_ context.Context, key agentrun.ProviderSessionKey, reason string) error
MarkProviderSessionFailed implements agentrun.ProviderSessionStore.
func (*SQLiteSessionStore) UpsertProviderSession ¶
func (s *SQLiteSessionStore) UpsertProviderSession(_ context.Context, binding *agentrun.ProviderSessionBinding) error
UpsertProviderSession implements agentrun.ProviderSessionStore.