Help us shape the future of Go! Take the 2026 Go Developer Survey

agentlineapp

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const InteractionAnnotationKey = "agentline.interaction.v1"

InteractionAnnotationKey 是注入到 Invocation.Annotations 的协议入口键。

协议约定(v1):

  1. 命令侧通过 InteractionFromInvocation 获取桥接对象;
  2. 调用 Emit 推送中间态事件(system/user/assistant/tool/error);
  3. 调用 Ask 发起阻塞提问,用户可在 agentline 中通过 /questions /reply /skip 响应;
  4. Ask 返回后命令继续执行,形成“命令 <-> UI”的双向交互。

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, root *redant.Command, opts *RuntimeOptions) error

Types

type AskRequest

type AskRequest struct {
	Prompt string
}

type AskResponse

type AskResponse struct {
	Answer    string
	Cancelled bool
}

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 InteractionEvent struct {
	Kind  string
	Title string
	Lines []string
}

type PendingQuestion

type PendingQuestion struct {
	ID        string
	Prompt    string
	CreatedAt time.Time
}

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) Reply

func (b *QuestionBroker) Reply(id string, answer string) error

func (*QuestionBroker) Request

func (b *QuestionBroker) Request(ctx context.Context, req AskRequest) (AskResponse, error)

type RuntimeOptions

type RuntimeOptions struct {
	Prompt         string
	PermissionMode string
	HistoryFile    string
	NoHistory      bool
	InitialArgv    []string
	Stdin          io.Reader
	Stdout         io.Writer
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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