Documentation
¶
Overview ¶
Package claudecode provides an AI provider that invokes the Claude Code CLI as a subprocess, reusing the user's Claude Pro/Max subscription instead of requiring separate API tokens.
Index ¶
- Constants
- type Client
- func (c *Client) GetMaxTokens() int
- func (c *Client) GetModel() string
- func (c *Client) SendMessage(ctx context.Context, message string) (string, error)
- func (c *Client) SendMessageWithHistory(ctx context.Context, messages []types.Message) (string, error)
- func (c *Client) SendMessageWithSystemPrompt(ctx context.Context, systemPrompt string, messages []types.Message) (string, error)
- func (c *Client) SendMessageWithSystemPromptAndTools(ctx context.Context, systemPrompt string, atmosMemory string, ...) (*types.Response, error)
- func (c *Client) SendMessageWithTools(_ context.Context, _ string, _ []tools.Tool) (*types.Response, error)
- func (c *Client) SendMessageWithToolsAndHistory(_ context.Context, _ []types.Message, _ []tools.Tool) (*types.Response, error)
- func (c *Client) SetApprover(approver approval.Approver)
- func (c *Client) SetProgressHandler(handler func(approval.Event))
- func (c *Client) SetTimeout(timeout time.Duration)
Constants ¶
const ( // ProviderName is the name of this provider for configuration lookup. ProviderName = "claude-code" // DefaultBinary is the default binary name for Claude Code. DefaultBinary = "claude" // DefaultMaxTurns is the default maximum agentic turns per invocation. DefaultMaxTurns = 5 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client invokes the Claude Code CLI in non-interactive mode.
func NewClient ¶
func NewClient(atmosConfig *schema.AtmosConfiguration) (*Client, error)
NewClient creates a new Claude Code CLI client from Atmos configuration.
func (*Client) GetMaxTokens ¶
GetMaxTokens returns 0 — managed by Claude Code internally.
func (*Client) SendMessage ¶
SendMessage sends a prompt to Claude Code and returns the response.
func (*Client) SendMessageWithHistory ¶
func (c *Client) SendMessageWithHistory(ctx context.Context, messages []types.Message) (string, error)
SendMessageWithHistory concatenates history into a single prompt.
func (*Client) SendMessageWithSystemPrompt ¶
func (c *Client) SendMessageWithSystemPrompt(ctx context.Context, systemPrompt string, messages []types.Message) (string, error)
SendMessageWithSystemPrompt sends messages with a system prompt via --append-system-prompt, without tools.
func (*Client) SendMessageWithSystemPromptAndTools ¶
func (c *Client) SendMessageWithSystemPromptAndTools( ctx context.Context, systemPrompt string, atmosMemory string, messages []types.Message, _ []tools.Tool, ) (*types.Response, error)
SendMessageWithSystemPromptAndTools sends with system prompt via --append-system-prompt.
func (*Client) SendMessageWithTools ¶
func (c *Client) SendMessageWithTools(_ context.Context, _ string, _ []tools.Tool) (*types.Response, error)
SendMessageWithTools is not supported — Claude Code manages its own tools.
func (*Client) SendMessageWithToolsAndHistory ¶
func (c *Client) SendMessageWithToolsAndHistory(_ context.Context, _ []types.Message, _ []tools.Tool) (*types.Response, error)
SendMessageWithToolsAndHistory is not supported — Claude Code manages its own tools.
func (*Client) SetApprover ¶
SetApprover registers the approver consulted before Claude runs a tool that needs permission. Passing nil restores unattended operation.
func (*Client) SetProgressHandler ¶
SetProgressHandler registers a callback for tool progress events. The callback runs on the goroutine that called SendMessage*, never concurrently with it.
func (*Client) SetTimeout ¶
SetTimeout sets the run timeout. Time spent inside the approver does not count. Zero disables the timeout (the caller's context still applies).