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

acpclient

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: 10 Imported by: 0

Documentation

Overview

Package acpclient 提供 fastgit 作为 ACP Client 的最小可用实现: spawn 外部 ACP agent 子进程,通过 stdio JSON-RPC 完成 initialize -> session/new -> session/prompt,并收集 agent_message 文本。

Index

Constants

View Source
const DefaultTimeout = 2 * time.Minute

DefaultTimeout 是单轮 prompt 的默认上限。

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	Name    string
	Command string
	Args    []string
	Env     map[string]string
}

Agent 描述如何启动一个 ACP agent 子进程。

type Options

type Options struct {
	// Cwd 为 session 工作目录,空则使用当前目录。
	Cwd string
	// System 与 Prompt 合并为一条用户消息(ACP 没有独立的 system 通道)。
	System string
	Prompt string
	// Timeout 为整个轮次上限,零值使用 DefaultTimeout。
	Timeout time.Duration
	// OnUpdate 可选,收到每个 session/update 时回调。
	OnUpdate func(update acp.SessionUpdate) error
}

Options 控制一次 prompt 轮次。

type Result

type Result struct {
	Text       string
	StopReason acp.StopReason
}

Result 是一次 prompt 轮次的输出。

func Run

func Run(ctx context.Context, agent Agent, opts Options) (Result, error)

Run spawns the agent, performs one prompt turn and returns the collected agent_message text. The agent process is always terminated before returning.

Jump to

Keyboard shortcuts

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