Documentation
¶
Overview ¶
Package agent provides the ACP agent implementation for GitLab Duo.
Index ¶
- Constants
- Variables
- type ACPConnection
- type ActionResponder
- type Agent
- func (a *Agent) Authenticate(ctx context.Context, params acp.AuthenticateRequest) (acp.AuthenticateResponse, error)
- func (a *Agent) Cancel(ctx context.Context, params acp.CancelNotification) error
- func (a *Agent) Initialize(ctx context.Context, params acp.InitializeRequest) (acp.InitializeResponse, error)
- func (a *Agent) NewSession(ctx context.Context, params acp.NewSessionRequest) (acp.NewSessionResponse, error)
- func (a *Agent) Prompt(ctx context.Context, params acp.PromptRequest) (acp.PromptResponse, error)
- func (a *Agent) SetAgentConnection(conn *acp.AgentSideConnection)
- func (a *Agent) SetSessionMode(ctx context.Context, params acp.SetSessionModeRequest) (acp.SetSessionModeResponse, error)
Constants ¶
const AgentName = "gitlab-duo-acp"
AgentName is the name of this agent.
Variables ¶
var ( // ErrSessionNotFound is returned when a session ID doesn't exist. ErrSessionNotFound = errors.New("session not found") // ErrPathOutsideWorkspace is returned when a file path is outside the workspace. ErrPathOutsideWorkspace = errors.New("path is outside workspace") // ErrFileSystemNotSupported is returned when the client doesn't support file system operations. ErrFileSystemNotSupported = errors.New("client does not support file system operations") // ErrTextNotFound is returned when the text to replace is not found in the file. ErrTextNotFound = errors.New("the specified text was not found in the file") // ErrAmbiguousMatch is returned when the text to replace appears multiple times. ErrAmbiguousMatch = errors.New("text appears multiple times; provide more context to make the match unique") )
Functions ¶
This section is empty.
Types ¶
type ACPConnection ¶ added in v0.1.0
type ACPConnection interface {
SessionUpdate(ctx context.Context, params acp.SessionNotification) error
ReadTextFile(ctx context.Context, params acp.ReadTextFileRequest) (acp.ReadTextFileResponse, error)
WriteTextFile(ctx context.Context, params acp.WriteTextFileRequest) (acp.WriteTextFileResponse, error)
}
ACPConnection defines the ACP client methods used by the agent. This interface enables testing without a real ACP connection.
type ActionResponder ¶ added in v0.1.0
ActionResponder sends action responses back to the Duo Workflow Service. This interface enables testing without a real WebSocket connection.
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent implements the acp.Agent interface for GitLab Duo.
func (*Agent) Authenticate ¶
func (a *Agent) Authenticate(ctx context.Context, params acp.AuthenticateRequest) (acp.AuthenticateResponse, error)
Authenticate implements acp.Agent. Stub implementation for now.
func (*Agent) Cancel ¶
Cancel implements acp.Agent. It cancels an ongoing operation in a session while keeping the session valid for subsequent prompts. The workflow is preserved so future messages can continue the conversation.
func (*Agent) Initialize ¶
func (a *Agent) Initialize(ctx context.Context, params acp.InitializeRequest) (acp.InitializeResponse, error)
Initialize implements acp.Agent. It returns the agent's capabilities and protocol version.
func (*Agent) NewSession ¶
func (a *Agent) NewSession(ctx context.Context, params acp.NewSessionRequest) (acp.NewSessionResponse, error)
NewSession implements acp.Agent. It creates a new chat session and returns its ID.
func (*Agent) Prompt ¶
func (a *Agent) Prompt(ctx context.Context, params acp.PromptRequest) (acp.PromptResponse, error)
Prompt implements acp.Agent. It handles user prompts by connecting to the Duo Workflow Service and streaming responses back to the client.
func (*Agent) SetAgentConnection ¶
func (a *Agent) SetAgentConnection(conn *acp.AgentSideConnection)
SetAgentConnection implements acp.AgentConnAware. It receives the connection after construction so the agent can send updates.
func (*Agent) SetSessionMode ¶
func (a *Agent) SetSessionMode(ctx context.Context, params acp.SetSessionModeRequest) (acp.SetSessionModeResponse, error)
SetSessionMode implements acp.Agent. Stub implementation for now.