claude

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PromptMD string

Functions

This section is empty.

Types

type ClaudeCode

type ClaudeCode struct {
	// contains filtered or unexported fields
}

ClaudeCode implements agent.Agent by spawning Claude Code with an MCP bridge.

func New

func New(ctx context.Context, opts ...Option) (*ClaudeCode, error)

New creates a new ClaudeCode agent. The provided ctx controls the lifetime of all internal goroutines (accept loop, bridge readers, etc.).

func (*ClaudeCode) ActiveSessions

func (c *ClaudeCode) ActiveSessions() []string

func (*ClaudeCode) CLICommands

func (c *ClaudeCode) CLICommands() []string

func (*ClaudeCode) Close

func (c *ClaudeCode) Close(userID string) error

Close terminates a user's session.

func (*ClaudeCode) CloseAll

func (c *ClaudeCode) CloseAll() error

CloseAll terminates all sessions and cleans up the socket.

func (*ClaudeCode) Control

func (c *ClaudeCode) Control(ctx context.Context, userID string, action types.Action) (bool, error)

Control handles out-of-band user actions such as confirm/deny/select.

func (*ClaudeCode) Name

func (c *ClaudeCode) Name() string

Name returns the agent identifier.

func (*ClaudeCode) RawInput

func (c *ClaudeCode) RawInput(ctx context.Context, userID string, input string) error

RawInput sends text directly to the agent's terminal, bypassing MCP. Polls capture-pane for TUI menu response.

func (*ClaudeCode) RespawnSession

func (c *ClaudeCode) RespawnSession(ctx context.Context, userID, workDir, resumeOpt string) (bool, error)

RespawnSession switches the user's session to a different working directory.

func (*ClaudeCode) Restart

func (c *ClaudeCode) Restart(ctx context.Context, userID string, flags map[string]string) (bool, error)

Restart terminates the user's current session and starts a new one with the given flags.

func (*ClaudeCode) Send

func (c *ClaudeCode) Send(ctx context.Context, userID string, msg agent.Message) error

Send sends a message to the user's Claude Code session. Non-blocking. Responses arrive asynchronously via the channel returned by Subscribe.

func (*ClaudeCode) Subscribe

func (c *ClaudeCode) Subscribe(userID string) <-chan *agent.Response

Subscribe returns a channel that receives all responses for a user.

type Option

type Option func(*ClaudeCode)

Option configures a ClaudeCode agent.

func WithBridgeBin

func WithBridgeBin(bin string) Option

WithBridgeBin sets the path to the bridge binary.

func WithClaudeCmd

func WithClaudeCmd(cmd string) Option

WithClaudeCmd sets the path to the claude CLI binary.

func WithClaudeMD

func WithClaudeMD(content string) Option

WithClaudeMD sets the CLAUDE.md content written to each session workdir.

func WithModel

func WithModel(model string) Option

WithModel sets the model for Claude Code.

func WithRuntime

func WithRuntime(rt runtime.Runtime) Option

WithRuntime sets the runtime container (tmux, screen, etc.) for hosting Claude sessions.

func WithWorkDir

func WithWorkDir(dir string) Option

WithWorkDir sets the base working directory for sessions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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