Documentation
¶
Index ¶
Constants ¶
View Source
const InteractionAnnotationKey = "agentline.interaction.v1"
InteractionAnnotationKey 是注入到 Invocation.Annotations 的协议入口键。
协议约定(v1):
- 命令侧通过 InteractionFromInvocation 获取桥接对象;
- 调用 Emit 推送中间态事件(system/user/assistant/tool/error);
- 调用 Ask 发起阻塞提问,用户可在 agentline 中通过 /questions /reply /skip 响应;
- Ask 返回后命令继续执行,形成“命令 <-> UI”的双向交互。
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AskRequest ¶
type AskRequest struct {
Prompt string
}
type AskResponse ¶
type InteractionBridge ¶
type InteractionBridge interface {
Emit(ctx context.Context, event InteractionEvent) error
Ask(ctx context.Context, req AskRequest) (AskResponse, error)
}
InteractionBridge 定义命令与 agentline 的双向通信接口。
func InteractionFromInvocation ¶
func InteractionFromInvocation(inv *redant.Invocation) (InteractionBridge, bool)
InteractionFromInvocation 从 Invocation 注解中提取交互桥。
type InteractionEvent ¶
type QuestionBroker ¶
type QuestionBroker struct {
// contains filtered or unexported fields
}
func NewQuestionBroker ¶
func NewQuestionBroker() *QuestionBroker
func (*QuestionBroker) Cancel ¶
func (b *QuestionBroker) Cancel(id string) error
func (*QuestionBroker) Pending ¶
func (b *QuestionBroker) Pending() []PendingQuestion
func (*QuestionBroker) Request ¶
func (b *QuestionBroker) Request(ctx context.Context, req AskRequest) (AskResponse, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.