Documentation
¶
Index ¶
- type ACPAgent
- func (a *ACPAgent) Chat(ctx context.Context, conversationID string, message string) (string, error)
- func (a *ACPAgent) ChatWithImage(ctx context.Context, conversationID string, message string, image *ImageInput) (string, error)
- func (a *ACPAgent) Info() AgentInfo
- func (a *ACPAgent) ResetSession(ctx context.Context, conversationID string) (string, error)
- func (a *ACPAgent) SetCwd(cwd string)
- func (a *ACPAgent) Start(ctx context.Context) error
- func (a *ACPAgent) Stop()
- type ACPAgentConfig
- type Agent
- type AgentInfo
- type CLIAgent
- type CLIAgentConfig
- type ChatMessage
- type HTTPAgent
- type HTTPAgentConfig
- type ImageChatAgent
- type ImageInput
- type ShellAgent
- type ShellAgentConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ACPAgent ¶
type ACPAgent struct {
// contains filtered or unexported fields
}
ACPAgent communicates with ACP-compatible agents (claude-agent-acp, codex-acp, cursor agent, etc.) via stdio JSON-RPC 2.0.
func NewACPAgent ¶
func NewACPAgent(cfg ACPAgentConfig) *ACPAgent
NewACPAgent creates a new ACP agent.
func (*ACPAgent) ChatWithImage ¶ added in v0.8.0
func (a *ACPAgent) ChatWithImage(ctx context.Context, conversationID string, message string, image *ImageInput) (string, error)
ChatWithImage sends a message with an image to the agent.
func (*ACPAgent) ResetSession ¶ added in v0.5.0
ResetSession clears the existing session for the given conversationID and immediately creates a new one, returning the new session ID.
func (*ACPAgent) SetCwd ¶ added in v0.5.0
SetCwd changes the working directory for subsequent sessions.
type ACPAgentConfig ¶
type ACPAgentConfig struct {
Command string // path to ACP agent binary (claude-agent-acp, codex-acp, cursor agent, etc.)
Args []string // extra args for command (e.g. ["acp"] for cursor)
Model string
SystemPrompt string
Cwd string // working directory
Env map[string]string // extra environment variables
}
ACPAgentConfig holds configuration for the ACP agent.
type Agent ¶
type Agent interface {
// Chat sends a message to the agent and returns the response.
// conversationID is used to maintain conversation history per user.
Chat(ctx context.Context, conversationID string, message string) (string, error)
// ResetSession clears the existing session for the given conversationID and
// starts a new one. Returns the new session ID if immediately available
// (ACP mode), or an empty string if the ID will be assigned on next Chat
// (CLI mode) or is not applicable (HTTP mode).
ResetSession(ctx context.Context, conversationID string) (string, error)
// Info returns metadata about this agent.
Info() AgentInfo
// SetCwd changes the working directory for subsequent operations.
SetCwd(cwd string)
}
Agent is the interface for AI chat agents.
type AgentInfo ¶
type AgentInfo struct {
Name string // e.g. "claude-acp", "claude", "gpt-4o"
Type string // e.g. "acp", "cli", "http"
Model string // e.g. "sonnet", "gpt-4o-mini"
Command string // binary path, e.g. "/usr/local/bin/claude-agent-acp"
PID int // subprocess PID (0 if not applicable, e.g. http agent)
}
AgentInfo holds metadata about an agent for logging/debugging.
type CLIAgent ¶
type CLIAgent struct {
// contains filtered or unexported fields
}
CLIAgent invokes a local CLI agent (claude, codex, etc.) via streaming JSON.
func NewCLIAgent ¶
func NewCLIAgent(cfg CLIAgentConfig) *CLIAgent
NewCLIAgent creates a new CLI agent.
func (*CLIAgent) ResetSession ¶ added in v0.5.0
ResetSession clears the existing session for the given conversationID. Returns an empty string because the new session ID is only known after the next Chat call (claude assigns it during the conversation).
type CLIAgentConfig ¶
type CLIAgentConfig struct {
Name string // agent name for logging, e.g. "claude", "codex"
Command string // path to binary
Args []string // extra args (e.g. ["--dangerously-skip-permissions"])
Cwd string // working directory (workspace)
Env map[string]string // extra environment variables
Model string
SystemPrompt string
}
CLIAgentConfig holds configuration for a CLI agent.
type ChatMessage ¶
ChatMessage represents a single message in a conversation.
type HTTPAgent ¶
type HTTPAgent struct {
// contains filtered or unexported fields
}
HTTPAgent is an OpenAI-compatible chat completions API client.
func NewHTTPAgent ¶
func NewHTTPAgent(cfg HTTPAgentConfig) *HTTPAgent
NewHTTPAgent creates a new OpenAI-compatible HTTP agent.
func (*HTTPAgent) Chat ¶
func (a *HTTPAgent) Chat(ctx context.Context, conversationID string, message string) (string, error)
Chat sends a message to the OpenAI-compatible API and returns the response.
func (*HTTPAgent) ResetSession ¶ added in v0.5.0
ResetSession clears the conversation history for the given conversationID. HTTP agents have no server-side session ID, so an empty string is returned.
type HTTPAgentConfig ¶
type HTTPAgentConfig struct {
Endpoint string
APIKey string
Model string
SystemPrompt string
MaxHistory int
}
HTTPAgentConfig holds configuration for the HTTP agent.
type ImageChatAgent ¶ added in v0.8.0
type ImageChatAgent interface {
Agent
ChatWithImage(ctx context.Context, conversationID string, message string, image *ImageInput) (string, error)
}
ImageChatAgent is an optional interface for agents that support image input.
type ImageInput ¶ added in v0.8.0
type ImageInput struct {
MimeType string // e.g. "image/jpeg", "image/png"
Data []byte // raw image bytes
}
ImageInput holds image data for multimodal chat.
type ShellAgent ¶ added in v0.8.0
type ShellAgent struct {
// contains filtered or unexported fields
}
ShellAgent executes shell commands directly and returns their output. It allows users to run arbitrary commands from WeChat and see the results.
func NewShellAgent ¶ added in v0.8.0
func NewShellAgent(cfg ShellAgentConfig) *ShellAgent
NewShellAgent creates a new shell agent.
func (*ShellAgent) Chat ¶ added in v0.8.0
Chat executes the message as a shell command and returns stdout+stderr.
func (*ShellAgent) Info ¶ added in v0.8.0
func (a *ShellAgent) Info() AgentInfo
Info returns metadata about this agent.
func (*ShellAgent) ResetSession ¶ added in v0.8.0
ResetSession is a no-op for shell agents (no session state).
func (*ShellAgent) SetCwd ¶ added in v0.8.0
func (a *ShellAgent) SetCwd(cwd string)
SetCwd changes the working directory for subsequent commands.